Exemplo n.º 1
0
        public void Configure(IWebJobsBuilder builder)
        {
            var configurationBuilder      = StartupService.GetCurrentConfigurationObject(builder);
            var currentConfiguration      = configurationBuilder.Build();
            var currentRunningEnvironment = StartupService.CheckCurrentApplicationEnvironmentCategory(currentConfiguration);

            switch (currentRunningEnvironment)
            {
            case EnvironmentCategory.LocalDevelopment:
                StartupService.ConfigureLocalDevelopmentSecretsStorage(configurationBuilder);
                break;

            case EnvironmentCategory.Production:
                StartupService.ConfigureAzureKeyVaultSecretsStorage(configurationBuilder, currentConfiguration);
                break;
            }


            currentConfiguration = configurationBuilder.Build();
            builder.Services.Replace(ServiceDescriptor.Singleton(typeof(IConfiguration), currentConfiguration));

            ConfigurationManager.Initialize(currentConfiguration);
        }