Skip to content

Instantly share code, notes, and snippets.

@rasgo-cc
Last active March 18, 2019 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rasgo-cc/876459af703afd9c973adab6896ce293 to your computer and use it in GitHub Desktop.
Save rasgo-cc/876459af703afd9c973adab6896ce293 to your computer and use it in GitHub Desktop.
Fetch Heroku config vars and save them into a dotenv file
#!/bin/bash
# Usage: heroku_dotenv.sh <heroku_app_name> <dotenv_file>
# Default dotenv_file: .env
dotenv=${2-".env"}
heroku config -a $1 |
sed -n '1!p' |
awk '{ gsub(/:/,"", $1); f=$1; $1=""; print f"="substr($0,2) }' > $dotenv
cat $dotenv
echo "File written: $dotenv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment