Ejemplo n.º 1
0
        public static void UseHypermediaActuator(IConfiguration configuration, ILoggerFactory loggerFactory = null)
        {
            var options           = new HypermediaEndpointOptions(configuration);
            var managementOptions = _mgmtOptions.OfType <ActuatorManagementOptions>().SingleOrDefault();

            if (managementOptions == null)
            {
                managementOptions = new ActuatorManagementOptions(configuration);
                _mgmtOptions.Add(managementOptions);
            }

            managementOptions.EndpointOptions.Add(options);

            var ep      = new ActuatorEndpoint(options, _mgmtOptions, CreateLogger <ActuatorEndpoint>(loggerFactory));
            var handler = new ActuatorHypermediaHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <ActuatorHypermediaHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);

            if (ConfiguredHandlers.OfType <CloudFoundryCorsHandler>().Any())
            {
                return;
            }

            var handler2 = new CloudFoundryCorsHandler(options, SecurityServices, _mgmtOptions, CreateLogger <CloudFoundryCorsHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler2);
        }
Ejemplo n.º 2
0
        public static void UseInfoActuator(IConfiguration configuration, IEnumerable <IInfoContributor> contributors = null, ILoggerFactory loggerFactory = null)
        {
            var options = new InfoEndpointOptions(configuration);

            _mgmtOptions.RegisterEndpointOptions(configuration, options);

            if (ConfiguredHandlers.OfType <InfoHandler>().Any())
            {
                return;
            }

            contributors = contributors ?? new List <IInfoContributor>()
            {
                new GitInfoContributor(), new AppSettingsInfoContributor(configuration)
            };
            var ep      = new InfoEndpoint(options, contributors, CreateLogger <InfoEndpoint>(loggerFactory));
            var handler = new InfoHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <InfoHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }
Ejemplo n.º 3
0
        public static void UseHealthActuator(IConfiguration configuration, IHealthAggregator healthAggregator = null, IEnumerable <IHealthContributor> contributors = null, ILoggerFactory loggerFactory = null)
        {
            var options = new HealthEndpointOptions(configuration);

            _mgmtOptions.RegisterEndpointOptions(configuration, options);
            if (ConfiguredHandlers.OfType <HealthHandler>().Any())
            {
                return;
            }

            healthAggregator = healthAggregator ?? new DefaultHealthAggregator();
            contributors     = contributors ?? new List <IHealthContributor>()
            {
                new DiskSpaceContributor(new DiskSpaceContributorOptions(configuration))
            };
            var ep      = new HealthEndpoint(options, healthAggregator, contributors, CreateLogger <HealthEndpoint>(loggerFactory));
            var handler = new HealthHandler(ep, SecurityServices, _mgmtOptions, CreateLogger <HealthHandler>(loggerFactory));

            ConfiguredHandlers.Add(handler);
        }