How do I set the envrionment variables on Endpoint so that the application knows to load the appsettings.Staging.config file instead of appsettings.Production.config?
Those need to be set at the shell (bash) level. Set DOTNET_ENVIRONMENT or ASPNETCORE_ENVIRONMENT to the name of your environment. The trick is that you have to set that in .bashrc or in the script that launches your program.
It would be useful if the Endpoint tool (and VSCode extension) allowed for setting environment variables as part of deployment, but until we have something like that, you have to go edit either ~/.bashrc or ~/.profile or the script that launches your program to set those env vars before launching your .net code.
Hum… Yeah, that would be nice in the configuration tool or something. Things to look forward to.
This feature is added from 0.1.7, EP tool config. Let us know if it needs to be improved.
Thanks
2 Likes