public static IWebHostBuilder UseStartupCompletedHealthCheck(this IWebHostBuilder builder, Action <StartupCompletedHealthCheckOptions> configureOptions)
        {
            var options = new StartupCompletedHealthCheckOptions();

            configureOptions?.Invoke(options);
            var healthCheck = new StartupCompletedHealthCheck(options);

            builder.ConfigureServices(services =>
            {
                services.TryAddSingleton <IStartupCompletedCallback>(healthCheck);

                services
                .AddHealthChecks()
                .AddCheck(nameof(StartupCompletedHealthCheck), healthCheck, null, new []
                {
                    "live",
                    "ready"
                });

                services.AddTransient <IStartupFilter, StartupCompletedFilter>();
            });
            return(builder);
        }
Example #2
0
 public StartupCompletedHealthCheck(StartupCompletedHealthCheckOptions options)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }