Dedicated Managers
Dedicated Managers

Reputation: 343

Do .Net Core environment variables effect anything deep in the project?

Per the Microsoft Article on enviornment variables, I am looking to implement environment variables in a .Net Core application.

I'm curious if setting the "ASPNETCORE_ENVIRONMENT" environment variable has any effects that are not specifically coded in the development source code (i.e. the code that would be checked into a repo such as git)?

In other words, if my appsettings.Development.json, appsettings.Production.json, and appsettings.Testing.json were all exactly the same and none of MY project code did any checks for the environment type, would the app run the same for all 3?

Or do the environment variables affect modules like maybe something down in the "Microsoft.AspNetCore.Hosting" namespace?

Upvotes: 2

Views: 381

Answers (1)

Marcel
Marcel

Reputation: 1109

No, it does not influence anything else, that would be very weird.

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.2

It only influences stuff you specified.

Yes it would run the same on all 3.

Upvotes: 1

Related Questions