Hello,
I have searched the forum about using environment variables and none of the suggestions consistently worked for me.
I’m on Phoenix 1.7.12 and have tried Dotenvy and DotenvParser for reading .env files.
.env
SECRET=123ABCDE
HELLO=WORLD
config/runtime.exs
import Dotenvy
source!([".env", System.get_env()])
config :my_app,
hello: env!("HELLO", :string!),
secret: env!("SECRET", :string!)
iex
Dotenvy.source!(".env")
# %{"HELLO" => "WORLD", "SECRET" => "123ABCDE"}
env!("HELLO", :string!)
# "WORLD"
Application.get_env(:my_app, :hello)
# nil
When I try Application.get_env(:my_app, :hello), it returns nil. Same deal if I use DotenvParser. Not sure what I’m doing wrong
Thanks






















