Last active
June 11, 2018 10:55
-
-
Save octagonal/8eb61f2471e3b45c033188b41db9d905 to your computer and use it in GitHub Desktop.
Some simple oneliners that make working with Heroku easier
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
# A collection of snippets for managing Heroku env vars | |
# It ain't pretty but it works | |
# Copy Heroku config to a local .env file | |
heroku config --app $HEROKU_APP | sed 's/: */=/' | tail -n +2 | tee $ENV_FILE | |
# Set a Heroku app's config from a local env file | |
# I got this oneliner from a blog somewhere, can't find it again | |
heroku config:set --app $HEROKU_APP $(cat .env | sed '/^$/d; /#[[:print:]]*$/d') | |
# Set a Heroku app's config from another Heroku app's config | |
heroku --app $HEROKU_APP config:set $(heroku config --app $HEROKU_APP_ORIGIN | sed 's/: */=/' | tail -n +2) | |
# Take a diff between two heroku configs (without messing around with temp files) | |
# Vimdiff is just what I prefer, any diff program which two files as input parameters will work | |
vimdiff <(heroku config --app $HEROKU_APP_ORIGIN) <(heroku config --app $HEROKU_APP) | |
# Locally run a process using a Heroku app's config (without copying to a temp file) | |
# If you wish to modify any of the config vars put them at the location of EXAMPLE_OVERRIDE=true | |
env $(heroku config --app $HEROKU_APP | sed 's/: */=/' | tail -n +2 | xargs) EXAMPLE_OVERRIDE=true node index.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment