This repository contains small scripts as well as instructions to read .env files in several languages.
Pkg.add("DotEnv")
Or through the REPL by writing ] add DotEnv
.
This packages includes a DotEnv.config
function that loads a .env
file into the global ENV
dictionary, allowing the same access pattern as normal environment variables.
using DotEnv
DotEnv.config()
Which allows us to simply access environment variables directly:
db_name = ENV["DB_NAME"]
println(db_name)