Hi,
I'm hosting my application (asp.net core + angular) on Azure App Service. I'm using SLOTS to publish my app.
First publish is made on SLOT stagging. On this stagging SLOT, I deactivate some features (like background workers) available on appsettings.production file. After validating that everything is working on stagging SLOT, I'm using Azure SWAP feature to switch application from stagging SLOT to production SLOT.
This works fine and it is a very nice feature.
The only problem is that I need to overwrite appsettings.production everytime I use this SWAP feature (in order to set everything up for production).
Do you know a way to avoid overwriting appsettings files after app is published ?
I'm wondering if the file appsettings.stagging (available on the startup template of aspnetzero) is here for that purpose...
3 Answer(s)
-
0
Hi @ricavir
Yes, appsettings.Staging.json should be used in Staging environment but it seems like in your case appsettings.Production.json is used, I'm not sure why that happens.
I haven't used Azure slots but below documents might help you to solve this problem if you haven't read them already;
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.2#set-the-environment
https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots
-
0
tks @Ismcagdas.
Thnaks to your links and other google search, I found the way : you just need to add an appsettings to the staging slot. Appsetting name must be : ASPNETCORE_ENVIRONMENT and value must be : Staging
This makes swaping slots much more safer.
I have now another issue on angular side for appconfig.json :
- Before building angular app, app is using appconfig.json
- After app building, app is using appconfig.production.json
Therefore, when swaping slots, I still have to change manually appconfig.production.json (because remoteServiceBaseUrl and appBaseUrl are different)
Do you have a tip avoid this manual change ?
-
0
As far as I know, It is not possible to change configuration of the angular project (prod, dev, staging etc...) after the build.
You can check https://github.com/angular/angular-cli/wiki/build for more inforamtion.