Skip to content

Commit

Permalink
Address FunctionsApplicationBuilder.Environment null (#2837)
Browse files Browse the repository at this point in the history
* Address FunctionsApplicationBuilder.Environment null

* Use correct host builder for environment
  • Loading branch information
jviau authored and fabiocav committed Nov 11, 2024
1 parent 1e6c717 commit 83da03f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/DotNetWorker/Builder/FunctionsApplicationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,14 @@ internal FunctionsApplicationBuilder(string[]? args)
/// <inheritdoc/>
public IDictionary<object, object> Properties => ((IHostApplicationBuilder)_hostApplicationBuilder).Properties;

/// <inheritdoc/>
IConfigurationManager IHostApplicationBuilder.Configuration => Configuration;

/// <summary>
/// Gets the set of key/value configuration properties.
/// </summary>
/// <remarks>
/// This can be mutated by adding more configuration sources, which will update its current view.
/// </remarks>
/// <inheritdoc/>
public ConfigurationManager Configuration => _hostApplicationBuilder.Configuration;

/// <inheritdoc/>
public IHostEnvironment Environment { get; private set; }
public IHostEnvironment Environment => _bootstrapHostBuilder.Context.HostingEnvironment;

/// <inheritdoc/>
public ILoggingBuilder Logging => _hostApplicationBuilder.Logging;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 83da03f

Please sign in to comment.