Last active
June 16, 2019 15:11
-
-
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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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