Skip to content

Instantly share code, notes, and snippets.

@Kameshwaran
Last active September 6, 2016 07:37
Show Gist options
  • Save Kameshwaran/6a281ca65645221846b677479cdf7a5c to your computer and use it in GitHub Desktop.
Save Kameshwaran/6a281ca65645221846b677479cdf7a5c to your computer and use it in GitHub Desktop.
Copy heroku config from one APP to another APP
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