コード例 #1
0
        public static string GetFullPath(ApiSettings apiSettings, HealthcheckSettings healthcheckSettings)
        {
            var basePath = apiSettings.GetPathPrefixConsideringVersion();

            basePath = ((string.IsNullOrWhiteSpace(basePath) == false) ? "/" + basePath.Trim('/') : "");
            var finalPathPart = healthcheckSettings.Path?.Trim('/');

            return((basePath ?? "") + "/" + (finalPathPart ?? "healthcheck"));
        }
コード例 #2
0
        public static void SetupHealthcheck(
            this IServiceCollection services,
            ApiSettings apiSettings,
            HealthcheckSettings healthcheckSettings,
            Action <IHealthChecksBuilder, IServiceProvider> builderFunction)
        {
            HealthcheckSettings = healthcheckSettings;
            ApiSettings         = apiSettings;

            if (healthcheckSettings?.Enabled == true)
            {
                var builder = services.AddHealthChecks();
                builderFunction?.Invoke(builder, services.BuildServiceProvider());
            }
        }