Why not just use `Application.get_env(app_name, var_name) || System.get_env(var_name)` in your init callback? Seems much clearer to me and requires no additions to get_env.
On Sat, 17 Dec 2016 at 09:17 José Valim <jose.va...@plataformatec.com.br> wrote: > There has been a couple discussions on the topic either here or on the > issues tracker. > > The consensus is that this problem needs to be solved but we are not quite > sure how. The only way to support {:system, "DATABASE_URL"} in a way that > it would also work for Erlang applications is by hijacking the application > controller using private APIs. We could also try solve this exclusively for > Elixir but then there would be gaps where it wouldn't be supported. > > Ecto 2.1 is trying a new approach where the value is configured using a > repository callback, that's what we will try to do when Phoenix 1.3 comes > out and see where it will lead us to. > > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > On Sat, Dec 17, 2016 at 1:48 AM, Cory ODaniel <c...@coryodaniel.com> > wrote: > > I've definitely run into issues where I need to pass an environment > variable at run time, but an application that I use doesn't support the > {:system, "DATABASE_URL"} or {:system, "PORT"} style environment variables > that Ecto and Phoenix support. > > I'm curious if it would be beneficial to add support in > Application.get_env/2 that when the value that returns matches {:system, > var} then System.get_env(var) would be called under the hood. > > -- > 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 elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/9fd6e998-04d2-4d7d-87ee-34abb16ee779%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/9fd6e998-04d2-4d7d-87ee-34abb16ee779%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 elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BOpmZ%3Ds3b2OvAH0chC9wwGL2HrRCB1v2ymbcjOzSc4BA%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BOpmZ%3Ds3b2OvAH0chC9wwGL2HrRCB1v2ymbcjOzSc4BA%40mail.gmail.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 elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAM-pwt7n0xP_AQDKX4Qc5DyM2u0B8K5VzEcULD5OCcKsTGaW2Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.