#422·dotenv

[would be great if] dotenv supported "source" from other envs

Author: palladiusCreated Jan 24, 2021Updated Nov 16, 2021

I have a somewhat complicated .env.{dev,staging,prod} which

source .env.common-pre

RAILS_ENV="staging"
MYSQL_ROOT_PASSWORD="blah"
MYSQL_USER="user"
MYSQL_PASS="blah"
MYSQL_HOST="1.2.3.4"
MYSQL_DBNAME="mydb"

source .env.common-post

All three environemnts source a common .env fragment at the beginning and end. In bash it works like a charm, of course.

I use dotenv for everything programmatic like passing env vars to docker, docker-compose and I LOVE it. I would love if dotenv was able to expand on additional .env based on bash command "source".