Jola, I think you hit the nail on the head! That seems to be exactly what’s going on. Here is some more code (forgive me for not sharing more earlier):
In my config I’m really specifying an API base url and API keys which change between testing/dev/production environments:
In config:
config :my_app, :some_api, %{base_url: "${IMPORTANT_URL}", api_key: "${API_KEY}"}
In my module I am referencing it via a module attribute:
@api_config Application.get_env(:my_app, :some_api)
So can you help me understand how this is being compiled and how I should refactor it? Is that correct that module attributes get resolved at compile time and so that forces the Application.get_env() to get evaluated? Whereas if I were to use the Application.get_env() inside a regular function, it wouldn’t execute until run-time?






















