Closed souenzzo closed 2 weeks ago
You missed some cons:
As compared to
There are cons with .env
files in general I am puzzling through how to give advice on. At work we use https://www.doppler.com/ and there is no "maybe accidentally committable .env" lying around. Before that we passed around a file through side channels and just made sure it was loaded into the terminal environment. If I can properly describe that then there is no need for any loader code. Its just (System/getenv ...)
The thing that is pushing me in that direction is nvd-clojure
and clj-watson
. Those both want an environment variable to have creds for pulling in the vulnerability database. If .env
isn't loaded in the terminal thats a little annoying. You'd have to source .env && ...
I guess to note another approach - instead of environment variables passing around a full (maybe nested) config file is possible.
The reason I don't want to recommend that is
Replacing
start-env
with this codeWe are able to replace these Dotenv/.get calls with
(System/getProperty "POSTGRES_USERNAME")
and(Long/getLong "PORT")
PROS:
(Long/getLong "PORT" 8080)
~ (dotenv also support default values)app.server.port=8080
(short names likePORT
are also supported)port: 8080
andPORT=8080
syntaxes(System/setProperty "PORT" "3030")
org.slf4j.simpleLogger.defaultLogLevel=info
CONS: