Issue
I want to copy all the config vars set on one app to another.
Resolution
This is most easily accomplished with the Heroku CLI on a shell such as bash or zsh (the default on most Linux and MacOS systems, including Linux distributions installed on Windows via WSL).
You can use a sub-shell to pass the output of one command (getting config vars), to another command (setting config vars).
heroku config:set $(heroku config -s -a [source-app] |grep -v '^HEROKU_') -a [destination-app]
Where [source-app]
is the app to read config vars from, and [destination-app]
is the app to set config vars on.
config -s
is necessary when reading config vars in order to output them in a KEY=value
format, -s
is not used when setting config vars.
We also recommend the |grep -v '^HEROKU_'
in order to prevent copying config vars that are specific to the source app. For example; HEROKU_APP_ID. HEROKU_APP_NAME, HEROKU_RELEASE_VERSION, etc.