From 83da03fcb6393d05530f919797d26584c2b3a190 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Mon, 11 Nov 2024 10:10:38 -0800 Subject: [PATCH] Address FunctionsApplicationBuilder.Environment null (#2837) * Address FunctionsApplicationBuilder.Environment null * Use correct host builder for environment --- .../Builder/FunctionsApplicationBuilder.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/DotNetWorker/Builder/FunctionsApplicationBuilder.cs b/src/DotNetWorker/Builder/FunctionsApplicationBuilder.cs index 92f823d7..7fab0225 100644 --- a/src/DotNetWorker/Builder/FunctionsApplicationBuilder.cs +++ b/src/DotNetWorker/Builder/FunctionsApplicationBuilder.cs @@ -64,18 +64,14 @@ internal FunctionsApplicationBuilder(string[]? args) /// public IDictionary Properties => ((IHostApplicationBuilder)_hostApplicationBuilder).Properties; + /// IConfigurationManager IHostApplicationBuilder.Configuration => Configuration; - /// - /// Gets the set of key/value configuration properties. - /// - /// - /// This can be mutated by adding more configuration sources, which will update its current view. - /// + /// public ConfigurationManager Configuration => _hostApplicationBuilder.Configuration; /// - public IHostEnvironment Environment { get; private set; } + public IHostEnvironment Environment => _bootstrapHostBuilder.Context.HostingEnvironment; /// public ILoggingBuilder Logging => _hostApplicationBuilder.Logging; @@ -135,7 +131,6 @@ private IFunctionsWorkerApplicationBuilder InitializeHosting(BootstrapHostBuilde // Grab the HostBuilderContext from the property bag to use in the ConfigureWebHostBuilder. Then // grab the IWebHostEnvironment from the webHostContext. This also matches the instance in the IServiceCollection. //var hostContext = (HostBuilderContext)bootstrapHostBuilder.Properties[typeof(HostBuilderContext)]; - Environment = bootstrapHostBuilder.Context.HostingEnvironment; //Host = new ConfigureHostBuilder(bootstrapHostBuilder.Context, Configuration, Services); //WebHost = new ConfigureWebHostBuilder(webHostContext, Configuration, Services);