public static HealthEndpointOptions AddIndicator(this HealthEndpointOptions opts, IHealthIndicator indicator) { Ensure.NotNull(opts, nameof(opts)); Ensure.NotNull(indicator, nameof(indicator)); opts.Indicators.Add(indicator); return(opts); }
public static void ConfigureIoC(HttpConfiguration config, HealthEndpointOptions options) { var builder = new ContainerBuilder(); builder.RegisterApiControllers(System.Reflection.Assembly.GetExecutingAssembly()); builder.RegisterInstance(options); var container = builder.Build(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); }
public static void UseHealthEndpoint(this IAppBuilder app, HealthEndpointOptions options) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } app.UseWebApi(WebApiConfig.Configure(options)); }
public static HttpConfiguration Configure(HealthEndpointOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var config = new HttpConfiguration(); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Formatters.Remove(config.Formatters.FormUrlEncodedFormatter); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(); config.Routes.MapHttpRoute( name: "HealthEndpoint", routeTemplate: options.Route, defaults: new { controller = "HealthEndpoint", action = "CheckHealth" } ); ConfigureIoC(config, options); return(config); }