environ icon indicating copy to clipboard operation
environ copied to clipboard

Feature request: support for docker style .env files

Open bhurlow opened this issue 8 years ago • 8 comments

docker supports specifying environment vars using the --env-file flag.

It would be great if environ could also incorporate this type of file. This would look something like:

> cat .env
FOO=bar
S3_KEY=12345

@weavejester would you be open to a pr for something like this?

Thanks!

bhurlow avatar Nov 30 '15 15:11 bhurlow

Don't most of the tools that use .env set the environment anyway?

weavejester avatar Nov 30 '15 19:11 weavejester

in my case specifically, I intend to use the .env file to provision my docker container when running in production. When developing locally I want to use that same file to inject development env vars

bhurlow avatar Nov 30 '15 20:11 bhurlow

not sure I've seen many tools that set .env, most of them read from it

bhurlow avatar Nov 30 '15 20:11 bhurlow

Ran into the same use case. Would be quite nice to have it supported.

mitranim avatar Aug 31 '17 17:08 mitranim

There's https://github.com/tpope/lein-dotenv if that's applicable to your problems.

ghallberg avatar Nov 21 '17 10:11 ghallberg

Support for .env files would be really nice. This approach is well-known from Heroku and several programming language communities (e.g. Ruby and Node.js).

denisw avatar Mar 13 '18 18:03 denisw

agreed dotenv would be nice to use, coming from python and docker you specify your settings in .env files and load them in to configure your services for your environments, in the case of docker this is extra helpful as you may want to share things like database uri's between containers.

olymk2 avatar Feb 10 '19 18:02 olymk2

I look for a suggestion regarding my type of an issue. I guess this is what most of the commenters touch upon but don't refine enough.

In some react projects we use .config file and development app startup crashes if that file doesn't exist. On production everything is compiled into JS files and file loading is not performed.

Upon the first clone of the app the developer is forced to create this .config file (copy it from some kind of location like .config.example). For development it's nice to have this file added to .gitignore and force the developer to read the file with any local variables.

These local variables that I refer to are those that are different per person and machine. I think it's hard to force Android studio location or the same IP address. Let's be clear here, Android studio binaries are in different locations in Windows and GNU+Linux. So by using environ the developer is forced to not commit his version of project.clj file or load the environment vars into the shell (REPL too).

If I understand correctly environ devs want to be as non-intrusive as possible and this is great. This crash that is supposed to happen (by me) may not fall into 12factor™ app since there is mostly small amount of developers in a Clojure project.

What I want to ask is a similar project to what I described.

Invertisment avatar Apr 12 '20 06:04 Invertisment