3 ms·
This will look at it at runtime not build time. `System.fetch_env!("BUCKET_NAME")` is still in the body of the function and won't get executed until it's called
by ilikehurdles 3y ago
This will look at it at runtime not build time. `System.fetch_env!("BUCKET_NAME")` is still in the body of the function and won't get executed until it's called after application start.
It is still a good reason to use Application.get_env, and it should be preferred over peppering system environment variable fetches all over the application.
- losvedir 3y agoOh, of course. Brain fart moment. I pattern matched (ha!) to code I've seen too much where that's at compile time. Yeah, runtime here works but I agree is still not as good as Application.get_env. Aside from (IMO) code clarity reasons, last I checked it is (or can be) much quicker. Application is a quick ETS lookup, while System reaches out to the system and I forget the details but at one point that was much slower.