My app uses an api that requires an api key, which has to be secret.
While developing my app, I did
export API_KEY=...
and loaded it in config.exs
:
config :app_name, :api_key, System.get_env("API_KEY")
to be used later in code via:
Application.get_env(:app_name, :api_key)
After deploying the app via fly.io, I’ve run
fly secrets set API_KEY=...
and I can see it after running
fly secrets list
But the api stopped working on the deployed app complaining on the absence of the api key. And when logging Application.get_env(:app_name, :api_key)
it returns empty string indeed.
Please advise how to resolve this issue.