Last active
September 6, 2016 07:37
-
-
Save Kameshwaran/6a281ca65645221846b677479cdf7a5c to your computer and use it in GitHub Desktop.
Copy heroku config from one APP to another APP
This file contains 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
SOURCE_APP = ARGV[0] | |
DESTINATION_APP = ARGV[1] | |
if SOURCE_APP.nil? || DESTINATION_APP.nil? | |
puts 'USAGE: ruby copy_heroku_config.rb SOURCE_APP_NAME DESTINATION_APP_NAME' | |
end | |
# Parsing heroku configs | |
configs = `heroku config --app #{SOURCE_APP}` | |
configs = configs.split('\n') | |
configs.shift | |
# Iterating over the configs and setting it in the given app. | |
configs.each do | config | | |
key, value = config.split(':').map(&:strip) | |
puts system("heroku config:set #{key}=#{value} --app #{DESTINATION_APP}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment