Reputation: 6222
I'm using ASP.NET Core 2.2 currently. I have 4 environments Development - Developer machine (developing in VS) and three deployable environments DevelopmentServer, UAT and Production.
I'd like to use Development instead of DevelopmentServer to be consistent with other applications in my company (they use different technologies) and change Development to Local.
The final setup would be this:
Local - Developer machine (developing in VS) and three deployable environments:
Development
UAT
Production
My only concern is that there are some helpers methods in IHostingEnvironment
interface like IsDevelopment()
which compare the current environment to "Development"
which in my example would be wrong. It should compare it to "Local"
. Is there a way to override this behaviour? I can avoid using this method in my code but there may be 3rd party libraries which can potentially rely on this method.
Upvotes: 5
Views: 3459
Reputation: 3177
It should be possible to use the extension method IsEnvironment
if (env.IsEnvironment("Local"))
{
// your environment specific code
}
env
is IHostingEnvironment in this case
Upvotes: 1