Move template to .env config

so I have a function that takes the following

defp url(ip) do 
"some_url/#{ip}?access_key=..." 
end

as u can see, I use #{} here for parameter, but how would I move that to a .env file? For basic links/variables: okay, but how with #{}? Using dotenv parser btw

Seems like you’re building a URL here, so maybe just move the config to the .env file instead of the whole templating engine? Something like:

defp url(ip) do
  "some_url/#{Application.fetch_env!(:my_app, :ip)}?access_key=..."
end
1 Like