env file?
See original GitHub issuehi @jezdez, this may be completely out of scope as the project is literally named envdir, but I was wondering if its possible to provide a single file with all of the variables for each environment. so like:
prod
- .env
dev
- .env
this is mainly because I run programs both locally and with docker and docker allows me to specify a --env
argument with a single file of environment variables. this way I can use the same file of environment variables for locally running a program and docker
thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Declare default environment variables in file
Compose supports declaring environment variables in an environment file. ... Environment variables defined in the .env file are not automatically visible ...
Read more >.env file - IBM
env file lets you customize your individual working environment variables. Because the .env file is hidden, use the ls -a command to list...
Read more >What is .env ? How to Set up and run a .env file in Node?
env file ? The dotenv package for handling environment variables is the most popular option in the Node.js community. You can create an.env...
Read more >We need to talk about the .env | Platform.sh
env is a de facto standard for an ini-like file that contains fake environment variables. An application that supports .env files will, on...
Read more >Using .env Files for Environment Variables in Python ...
A .env file is a text file containing key value pairs of all the environment variables required by your application. This file is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks @blueyed, that’s what I ended up doing
posting this here for the future:
The snippets below accomplished what I needed.
Load
envs/local
or.env
into current shell:notes:
eval
withecho
in the for loop can help create a real env file if one likes. Sourcing it into the current shell worked well enough for me.docker-compose using external environment variables instead of an
env-file
filehttps://docs.docker.com/compose/environment-variables/#/substituting-environment-variables-in-compose-files
usage if env variables are loaded in current shell:
docker-compose up myservice
usage using envdir:envdir envs/local docker-compose up myservice
haha thanks! that looks good, I’ll have to try that. not as great at the bashfu just yet 😃