/// <summary>
 /// Configure.
 /// </summary>
 /// <param name="app">IApplicationBuilder.</param>
 /// <param name="env">IWebHostEnvironment.</param>
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 {
     (app.ApplicationServices.GetService <IConfiguration>() as Configuration).Init(env.ContentRootPath);
     app.UseExceptionHandler(new ExceptionHandlerOptions()
     {
         ExceptionHandler = (ctx) =>
         {
             var feature = ctx.Features.Get <IExceptionHandlerFeature>();
             app.ApplicationServices.GetService <ILogger>().Log(feature.Error);
             return(Task.FromResult(0));
         },
     });
     app.UseForwardedHeaders(new ForwardedHeadersOptions
     {
         ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
     });
     app.UseStaticFiles();
     app.UseRouting();
     app.UseSentryTracing();
     app.UseEndpoints(endpoints =>
     {
         endpoints.MapControllers();
         endpoints.MapHealthChecks("/health", new HealthCheckOptions()
         {
             ResultStatusCodes =
             {
                 [HealthStatus.Healthy]   = StatusCodes.Status200OK,
                 [HealthStatus.Degraded]  = StatusCodes.Status500InternalServerError,
                 [HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable,
             },
             AllowCachingResponses = false,
             ResponseWriter        = UIResponseWriter.WriteHealthCheckUIResponse,
         });
     });
     app.ApplicationServices.GetService <ILogger>().Info("Application started.");
     UpdateFeedsJobRunner.Schedule(app.ApplicationServices);
 }
 /// <summary>
 /// Main.
 /// </summary>
 /// <param name="args">args.</param>
 public static void Main(string[] args)
 {
     UpdateFeedsJobRunner.Schedule();
     BuildWebHost(args).Run();
 }