Skip to content

Instantly share code, notes, and snippets.

@joaofnds
Last active June 16, 2019 15:11
Show Gist options
  • Select an option

  • Save joaofnds/c103fd4cf3b91594f869ba98c25aab3f to your computer and use it in GitHub Desktop.

Select an option

Save joaofnds/c103fd4cf3b91594f869ba98c25aab3f to your computer and use it in GitHub Desktop.
Copies heroku env from one app to another. Call it with `ruby copy_heroku_env.rb my-app-to-copy-from my-app-to-copy-to`
require 'json'
from_app, to_app = ARGV
envs_to_ignore = ['DATABASE_URL']
config =
JSON.parse(`heroku config --app #{from_app} --json`)
.reduce('') do |memo, (key, value)|
if envs_to_ignore.include? key
memo
else
memo + "#{key}='#{value}' "
end
end
`heroku config:set --app #{to_app} #{config}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment