-
Notifications
You must be signed in to change notification settings - Fork 307
Remove IHostingEnvironment.Configuration property #528
Comments
#488 |
It's a really nice way to flow arbitrary config from the hosting API to the app |
Nope. It's a really bad way to make people think it's a good idea to use @Tratcher command line args are better handled with This property absolutely must be removed. It's an actively incorrect thing to use. |
|
Seemed to be, in the dnxcore tfm at least, which I think is the same as coreclr for that Type Sent from mobile device From: Chris Rmailto:[email protected] Environment.GetCommandLineArgs() isn't available on CoreCLR, correct? — |
I disagree. If you look at WebApplicationBuilder without var config = new ConfigurationBuilder()
.AddJsonFile("something.json")
.AddEnvironmentVariables()
.Build();
var application = new WebApplicationBuilder()
.UseConfiguration(config)
...
.Build();
That doesn't even work because the first arg is the application name, so it's really
I don't see why. /cc @DamianEdwards |
I totally get the motivation, but there are a dozen ways to pass references from-code-to-code that don't involve an IConfiguration on IHostingEnvironment. It's confusing to have templates which show a configuration loaded in startup constructor, and have a configuration passed on hosting environment which is ignored. Unless the template has also been changed to move the configuration loading outside of the startup class? In which case hosting shouldn't be connected to a hosting.json be default. The connection-by-default was only necessary for the case when no user code ran before startup was loaded. |
Lets talk when you're back in the states :) |
Sure but API freeze is coming up soon. So we should remove it and have examples on how to do it if we're going to do it |
Moving this to Backlog as we will be in RC2 ask mode very soon. If you feel strongly about this issue, please ping me. |
@lodejard @davidfowl Louis brought this back, do we have anything else to discuss about this? |
Sure - assuming we're all signed off on the change |
The fact that the hosting engine uses iconfiguration to grab some options at startup is its own business. It doesn't even need to be closed over after the builder/application start has completed.
There's nothing an application would correctly do while poking around or grabbing settings from the hosting engine's configuration sources.
The text was updated successfully, but these errors were encountered: