Set enviroment variables in Heroku from .env file
Asked Answered
R

1

6

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

Rawlings answered 13/2, 2021 at 11:54 Comment(0)
R
15

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

Rawlings answered 13/2, 2021 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.