Last active
June 16, 2019 15:12
-
-
Save joaofnds/567529ab94dc2a8298cc1455cc9c82b2 to your computer and use it in GitHub Desktop.
remove all heroku env variables except for database_url. Call it with `ruby heroku_clear_env.rb my-app`
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' | |
| app = ARGV[0] | |
| envs_to_ignore = ['DATABASE_URL'] | |
| keys = | |
| JSON.parse(`heroku config --app #{app} --json`) | |
| .reduce('') do |memo, (key, _value)| | |
| if envs_to_ignore.include? key | |
| memo | |
| else | |
| memo + "#{key} " | |
| end | |
| end | |
| `heroku config:unset --app #{app} #{keys}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment