Ivan, as several other people have mentioned already, the Elixir community is slowly moving away from this idiom.
If you still want to use it, though, I wrote a small library that will easily deal with this issue. It's called app_config <https://github.com/jcomellas/app_config> and you can find the hex package here <https://hex.pm/packages/app_config>. The documentation should be self-explanatory. The macros provided by the library create several functions that allow you to retrieve values from the application's environment or from OS environment variables using the same syntax. Enjoy, Juanjo On Mon, Aug 6, 2018 at 4:15 PM, Ivan Yurov <[email protected]> wrote: > While playing with deployment I found out that some libraries provide this > feature that you can put {:system, var} in configuration and then it's > resolved at runtime. However if it's in my code, I'd have to implement it > on my own. Wouldn't it be nice if it was supported by Application module by > default? Something like: > def get_env(app, key, default \\ nil) do > case :application.get_env(app, key, default) do > {:system, var} -> > System.get_env(var) || default > rest -> > rest > end > end > > Would it make sense? > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/elixir-lang-core/cf09772c-0540-49ef-998b- > 80747436f7bb%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/cf09772c-0540-49ef-998b-80747436f7bb%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAOLqyqz5t6%2B%2B0YLV98%2BNYLLGRYmV%3DPaDKpo2yW2_jcdjgzZ-QA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
