Want to build your Angular app once and deploy anywhere? Learn why compile-time configuration isn’t enough and how we can load configuration at run-time.
We’re building an Angular application and when we merge new code into the master branch of our git repo, we want our build tool (like Jenkins) to grab the latest code and build our deployment package for us. With our deployment package built (A.K.A the dist
folder), we want to head over to our deployment tool (like Octopus), select an environment to which we want to deploy our app, click a “deploy” button, and trust it to deploy our package, replacing our environment variables in a config file with values specific to the selected environment.
We need a configuration file that we can access from our Angular code at runtime — which means it has to exist in the dist
folder we intend to deploy. We need it there because we want to configure our deployment tool to replace the values of the environment variables within with values specific to the environment we deploy to.
#angular #configuration #CI/CD