Base solution for your next web application
Open Closed

Angular Admin UI appconfig.json for multiple environments. #3814


User avatar
0
josefernandez created

Hello,

I was able to deploy, both aspnet-core and angular. I ran into a couple of issue which forced me to modify the appconfig.json in the angular application. I had to change from localhost to the actual real url that I am using.

My question is, how do you deal with multiple appconfig.json files based on the environment. I have for the aspnet-core three environments, dev, staging and production and it works flawlessly. I can't say the same about the angular piece.

I can't do local development without modifying the appconfig.json (localhost:4200, etc). Then I have to change it back to the original values. Annoying.

I know I can use some sort of "hack" so that I have appconfig.dev.json and then during deployment, overwrite the appconfig.json with the corresponding one under any environment.

Is there a way to achieve this painlessly?

Thanks.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @JoseFernandez,

    You can move config values from appconfig.json to enviroment.*.ts files. So, when you build your app for production, different settings will be used, see <a class="postlink" href="https://github.com/angular/angular-cli/wiki/stories-application-environments">https://github.com/angular/angular-cli/ ... vironments</a>.