I'm trying to build a good CI/CD solution with an angular client and rest api. I want to have a "build once, deploy many" setup of my angular client. Mostly angular-cli is wonderfull for this, but what I cant find a good solution for is storing the api url somewhere that I can manipulate during deploy.
The scenarios I have tried:
1) Storing the url in environment.env.ts files. The problem with this approach is that the environment.ts file is built into the artifacts of the "ng build" step, so I cannot alter the url during deploy. I could store all source as artifacts of the build step, and then do "ng build"/bundle during deploy, but this makes for a very slow deploy step, and I wouldn't really be deploying the same artifacts to several environments.
2) Storing the url in a separate assets/settings.json file. The problem with this is that getting the settings.json requires an async http.get call, and I cant find a good way to ensure that I have received the url before I can call the rest api.
Anyone have a good solution to either of these problems? Or a better approach altogether?