public BuildsController(IOptions <AppSettings> appOptions, ICiBuildService ciBuildService, ILogger <BuildsController> logger, IUserRepository userRepository) { _appSettings = appOptions.Value; _ciBuildService = ciBuildService; _logger = logger; _userRepository = userRepository; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline public async void Configure(IApplicationBuilder app, IHostingEnvironment env, ICiBuildService ciBuildService, ICiQaService ciQaService, ICiStagingService ciStagingService, ILoggerFactory loggerFactory, IOptions <AuthSettings> settings, IUserRepository userRepository) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddFile("logs/{Date}.txt"); loggerFactory.AddDebug(); app.UseResponseCompression(); app.UseCors("DevCorsPolicy"); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme = settings.Value.AuthenticationScheme, LoginPath = PathString.Empty, AccessDeniedPath = PathString.Empty, AutomaticAuthenticate = true, AutomaticChallenge = true, Events = new CookieAuthenticationEvents { OnRedirectToLogin = context => { context.Response.StatusCode = 401; return(Task.FromResult(0)); } } }); app.UseResponseCaching(); app.UseMvc(); var dbWorks = await userRepository.TestConnection(); var ciBuildWorks = await ciBuildService.TestConnection(); var ciQaWorks = await ciQaService.TestConnection(); var ciStagingWorks = await ciStagingService.TestConnection(); if (!dbWorks || !ciBuildWorks || !ciQaWorks || !ciStagingWorks) { Environment.Exit(1); return; } await userRepository.EnsureAdminExists(); }