| 🚨 I found an awesome library to solve this problem. envsub can substitute env variables in file to values. If you are having the same problem, try using that library instead of this script.
- It's a shell script to add environment variables to Google App Engine config file (app.xml)
- It add environment variables to
app.xml
at deployment stage.
- Google App Engine config file have been exposing environment variables in the form of plain text.
- I wanted it to me more secure.
- When you deploy your code to Google App Engine via CD(Continuous Delivery) tool (e.g. Github Actions, Bitbucket pipelines, Circle CI, Etc.)
- Add name of environment variables that you want to add to
.env.array
inapp.xml
- Add key/value of environment variable in your CD tool settings.
- Add commands to run this script to your CD tool config file.
- It is expected to run correctly only when
app.xml
doesn't haveenv_variables
field. - You have to migrate all the environment variables from
app.xml
to CD tool settings.