Skip to content

Instantly share code, notes, and snippets.

@jamesr2323
Forked from nabucosound/heroku_env_copy.sh
Created May 24, 2017 00:56
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save jamesr2323/b9243d433daf8fd98c8b88a4bbd77ea7 to your computer and use it in GitHub Desktop.
Save jamesr2323/b9243d433daf8fd98c8b88a4bbd77ea7 to your computer and use it in GitHub Desktop.
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
config=""
while read line; do
config="$config $line"
done < <(heroku config --app "$sourceApp" --shell )
eval "heroku config:set $config --app $targetApp"
@michaelkl
Copy link

This really rocks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment