-
Hi, I managed to get a POC running. For the real thing, I would need to change the destination address of the clusters at runtime. Basically, I need to use an environment variable to set the destination. You can imagine that in Azure and depending on the deployment, my backend have a different host name. Is there a way to override the configuration within the bootstrapping of ASP.NET without altering the appsettings.json? Cheers, VP |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The Microsoft.Extensions IConfiguration system used by AspNetCore to read appsettings.json allows for layering config from different sources including files and environment variables. It should just be a matter of figuring out the right environment variable name to match the appsetings.json structure for the destination entry you need to add/update. The alternative is to use a full code based provider: |
Beta Was this translation helpful? Give feedback.
The Microsoft.Extensions IConfiguration system used by AspNetCore to read appsettings.json allows for layering config from different sources including files and environment variables. It should just be a matter of figuring out the right environment variable name to match the appsetings.json structure for the destination entry you need to add/update.
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#environment-variables
The alternative is to use a full code based provider:
https://microsoft.github.io/reverse-proxy/articles/configproviders.html