Hi! I have a project with a file “config.json” that contains connection string to the database, port and other settings to run the application. The project is hosted on github so that I store different values in that file in my development and production branches. Let’s say after testing I would like to merge all changes from development branch to production branch without moving dev config file to prod, so the question would be:
Is it possible to move those settings in environment variables in Circle CI so that "config.json" will be changed with the corresponding values depending on what branch triggered the build?
Example:
Doing a commit in “dev” branch would trigger a build that replaces variables in “config.json” file with development values and “master” branch – production values.
config.json could look like this:
{
"db": {
"name": "$DB_NAME",
"username": "$DB_USERNAME",
"password": "$DB_PASSWORD"
},
"server": {
"port": "$APP_PORT"
}
}
It must be a very usual problem - setup different config values for environments, how do you solve it with circle ci?
Appreciate any answer!