0
votes

I want to create Staging and Production versions of my appsettings.json configuration but can't see exactly how to do this.

I can see that there is an appsettings.Development.json file in my project, and that there is an environment variable called ASPNETCORE_ENVIRONMENT that is set to Development.

Presumably I need to create appsettings.Stage.json and appsettings.Production.json and set the value for ASPNETCORE_ENVIRONMENT accordingly?

If so, how would I set the value of ASPNETCORE_ENVIRONMENT in my release pipeline? I check in code with the Development settings, but these will need to be changed when I release to our Staging and Production environments.

1

1 Answers

1
votes

It's actually an environment variable in OS. For Windows you can set it via command line: setx ASPNETCORE_ENVIRONMENT "Production" or with PowerShell $Env:ASPNETCORE_ENVIRONMENT = "Production"

Check this for other OS.