|
|
@ -13,22 +13,18 @@ namespace WebStatus |
|
|
|
{ |
|
|
|
public class Startup |
|
|
|
{ |
|
|
|
public Startup(IHostingEnvironment env) |
|
|
|
public Startup(IConfiguration configuration) |
|
|
|
{ |
|
|
|
var builder = new ConfigurationBuilder() |
|
|
|
.SetBasePath(env.ContentRootPath) |
|
|
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |
|
|
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) |
|
|
|
.AddEnvironmentVariables(); |
|
|
|
Configuration = builder.Build(); |
|
|
|
Configuration = configuration; |
|
|
|
} |
|
|
|
|
|
|
|
public IConfigurationRoot Configuration { get; } |
|
|
|
public IConfiguration Configuration { get; } |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
|
|
public void ConfigureServices(IServiceCollection services) |
|
|
|
{ |
|
|
|
services.AddOptions(); |
|
|
|
|
|
|
|
// Add framework services.
|
|
|
|
services.AddHealthChecks(checks => |
|
|
|
{ |
|
|
@ -47,15 +43,13 @@ namespace WebStatus |
|
|
|
checks.AddUrlCheckIfNotNull(Configuration["mvc"], TimeSpan.FromMinutes(minutes)); |
|
|
|
checks.AddUrlCheckIfNotNull(Configuration["spa"], TimeSpan.FromMinutes(minutes)); |
|
|
|
}); |
|
|
|
|
|
|
|
services.AddMvc(); |
|
|
|
} |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) |
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env) |
|
|
|
{ |
|
|
|
loggerFactory.AddConsole(Configuration.GetSection("Logging")); |
|
|
|
loggerFactory.AddDebug(); |
|
|
|
|
|
|
|
if (env.IsDevelopment()) |
|
|
|
{ |
|
|
|
app.UseDeveloperExceptionPage(); |
|
|
|