5

I'm developing a Node application using Docker and docker-compose, which all have awesome ways to import multiple environment variables from a .env file.

Just wondering if there's a shortcut for updating a Heroku deployment's env vars instead of typing them out.

I've noticed there's no --env-file option on the official docs: https://devcenter.heroku.com/articles/config-vars

Kieran101
  • 565
  • 5
  • 18

1 Answers1

13

Using some xargs magic

cat .env.prod | xargs heroku config:set

# Output:
# API_PORT:       3000
# API_KEY_1:      ab-cd
# DB_PORT:        6379
# REDISCLOUD_URL: xxx

Happily sets multiple args from a local .env file

Kieran101
  • 565
  • 5
  • 18