set-heroku-env

0.1.7 • Public • Published

set-heroku-env

Use this script to set environment variables from a dotenv file to Heroku.

Create a script in package.json like:

{
  "scripts": {
    "config:heroku": "set-heroku-env --dotenv=.env.heroku"
  }
}

Then run with:

# with yarn
yarn config:heroku

# with NPM
npm run config:heroku

To specify a specific Heroku app use --app otherwise it uses the default app that you set up.

{
  "scripts": {
    "config:heroku": "set-heroku-env --app=heroku-app-name --dotenv=.env.heroku"
  }
}

How It Works

  • Sets all dotenv variables with a non-empty value on Heroku using heroku config:set VAR1=VALUE1 VAR2=VALUE2
  • Unsets all dotenv variables with no value on Heroku using heroku config:unset EMPTYVAR1 EMPTYVAR2

For example:

# These will be set on Heroku
VAR1=VALUE1
VAR2=VALUE2

# These will be unset on Heroku
EMPTYVAR1=
EMPTYVAR2=

Readme

Keywords

none

Package Sidebar

Install

npm i set-heroku-env

Weekly Downloads

1

Version

0.1.7

License

MIT

Unpacked Size

7.61 kB

Total Files

6

Last publish

Collaborators

  • thesunny