I ran fly deploy command after adding new secrets.
In phoenix app, i am accessing secrets in config.exs file.
To check they are available in app. I entered into iex shell after fly ssh console and ran System.get_env(“AWS_ACCESS_KEY_ID”) which returns correct value.
But when i run Application.get_env(:ex_aws, :access_key_id), it still returns nil.
Here is code in my config.exs
You most likely don’t need them at build/compile time, and you instead should read and set them in your config/runtime.exs file, which will read them at runtime at startup where they’ll be available.
Thanks for taking a look at it.
Yup I am moving them to runtime.exs because it is most good fit solution on fly because it reads secrets at runtime.
Actually I was accessing env vars in Module body (not in function) where i had to read them at compile time.
Now I have moved them within function to use Application.get_env/2