Skip to content

Instantly share code, notes, and snippets.

@santospatrick
Created August 22, 2024 17:36
Show Gist options
  • Save santospatrick/fff959bbac0dd091afeb25d20bb97963 to your computer and use it in GitHub Desktop.
Save santospatrick/fff959bbac0dd091afeb25d20bb97963 to your computer and use it in GitHub Desktop.
Get Heroku environment variables from a Project into a .env file
chmod +x heroku_env_to_dotenv.sh
./heroku_env_to_dotenv.sh
#!/bin/bash
# Replace 'your-app-name' with the name of your Heroku app
HEROKU_APP_NAME="your-app-name"
# Fetch the config variables from the Heroku app
heroku config -a "$HEROKU_APP_NAME" -s > .env
# Inform the user that the .env file has been created
echo ".env file created with the Heroku config variables."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment