`Mix.env()` is not available in runtime.exs
chrissimon-au opened this issue · 0 comments
chrissimon-au commented
In config-and-releases.markdown when describing the routing table for production it's not 100% clear where to locate the new production routing table configuration.
If you assume it should be appended to runtime.exs you get an error when running the foo release:
ERROR! Config provider Config.Reader failed with:
** (UndefinedFunctionError) function Mix.env/0 is undefined (module Mix is not available)
Mix.env()
(stdlib 3.15.1) erl_eval.erl:685: :erl_eval.do_apply/6
(stdlib 3.15.1) erl_eval.erl:476: :erl_eval.expr/5
(stdlib 3.15.1) erl_eval.erl:270: :erl_eval.expr/5
(elixir 1.12.0) src/elixir.erl:280: :elixir.recur_eval/3
(elixir 1.12.0) src/elixir.erl:265: :elixir.eval_forms/3
(elixir 1.12.0) lib/code.ex:656: Code.eval_string_with_error_handling/3
(elixir 1.12.0) lib/config.ex:258: Config.__eval__!/3
{"init terminating in do_boot",{undef,[{'Elixir.Mix',env,[],[]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,685}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,476}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,270}]},{elixir,recur_eval,3,[{file,"src/elixir.erl"},{line,280}]},{elixir,eval_forms,3,[{file,"src/elixir.erl"},{line,265}]},{'Elixir.Code',eval_string_with_error_handling,3,[{file,"lib/code.ex"},{line,656}]},{'Elixir.Config','__eval__!',3,[{file,"lib/config.ex"},{line,258}]}]}}
init terminating in do_boot ({undef,[{Elixir.Mix,env,[],[]},{erl_eval,do_apply,6,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{elixir,recur_eval,3,[{_},{_}]},{elixir,eval_forms,3
I have an inbound PR with a suggested change that clarifies the location, and switches to config_env().