I am building the project in release mode. when I run it I want to be able to specify which environment to run against. What is the best way to achieve this?
Im not sure where the project pick up the current environment, perhaps within the AbpBootstrapper.Create method?
Guidance welcome. Ideally I will just pass an argument to the programe, environment or something like that.
2 Answer(s)
-
0
hi
The framework is using net core environment. Web and console projects. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-3.1
Can you explain your use case in detail?
-
0
I found the issue in the end.
I am setting the env before starting the app, the issue I had was the migrator app never picked up the connection string from my appsettings.{environment}.json file.
I had to make a small modification to the {Application}MigratorModule.
In the constructor I added:
string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
and amended the call to
AppConfigurations.Get
to include the environment as per above as the second parameter.Once this was done the migrator app would use the appsettings files I was expecting / wanting it to use.