Skip to content

Instantly share code, notes, and snippets.

@incanus
Created December 6, 2011 19:56
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save incanus/1439684 to your computer and use it in GitHub Desktop.
Save incanus/1439684 to your computer and use it in GitHub Desktop.
Script to export Heroku environment variables to the local shell
#!/bin/sh
for x in `heroku config`; do
if [[ $x == HUBOT* ]]; then
name=$x
elif [ $x != '=>' ]; then
value=$x
export $name=$value
fi
done
echo
echo "Heroku config exported to environment:"
echo
printenv | grep HUBOT
echo
@azr
Copy link

azr commented Jul 8, 2016

I personally use

export `heroku config -s`

@alarmdev
Copy link

alarmdev commented Dec 7, 2018

you have to use -a or --app in order export config for an application so it would be.

heroku config -s -a TEST_APP

@dstecholution
Copy link

dstecholution commented Sep 15, 2022

easy enough to just do the following one liner:

heroku apps | sed '1d' | xargs -I{} heroku config -a {}

@TahaBoulehmi
Copy link

I wrote this JavaScript code. This could be useful for those who would like to download the .env file from heroku's website.

https://gist.github.com/TahaBoulehmi/ef9e8f9123e53590bdefc050c6b568ba

@misteryomi
Copy link

@TahaBoulehmi Works perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment