godotenv icon indicating copy to clipboard operation
godotenv copied to clipboard

using .env files only in development environment?

Open cocodrino opened this issue 4 years ago • 1 comments

Hi, I'd like that when I'm developing locally godotenv can read my .env file, but when the code will be deployed in the server, this takes the variables from the environment defined variables, is this possible? thank you

cocodrino avatar Mar 05 '21 22:03 cocodrino

I installed the bin via

go install github.com/joho/godotenv/cmd/godotenv

and then run my code via

godotenv go run ./cmd/serve/main.go

which reads .env from current dir, alternatively pass in paths via -f like so

godotenv -f /path/to/.env,/another/.env go run ./cmd/serve/main.go

like explained in readme

CanRau avatar Jan 21 '22 11:01 CanRau