distillery icon indicating copy to clipboard operation
distillery copied to clipboard

can't access config file with eval

Open michelangelomo opened this issue 5 years ago • 0 comments

Steps to reproduce

  1. Try to access Application.get_env from release task called with $RELEASE_ROOT_DIR/bin/application_name eval --mfa "Elixir.ApplicationName.Deploy.ReleaseTasks.$task/$#" $@

Verbose Logs

running task: Elixir.ApplicationName.Deploy.ReleaseTasks.method *arguments*
Loading app...
Starting dependencies...
Starting repos...
[info] starting UserProvider 
** (EXIT from #PID<0.93.0>) an exception was raised:
    ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil. This protocol is implemented for: Ecto.Adapters.SQL.Stream, Postgrex.Stream, DBConnection.PrepareStream, DBConnection.Stream, Timex.Interval, HashDict, MapSet, List, HashSet, Stream, Function, Map, GenEvent.Stream, IO.Stream, Date.Range, File.Stream, Range
        (elixir) /usr/local/src/elixir/lib/elixir/lib/enum.ex:1: Enumerable.impl_for!/1
        (elixir) /usr/local/src/elixir/lib/elixir/lib/enum.ex:141: Enumerable.reduce/3
        (elixir) lib/enum.ex:3015: Enum.reduce/3
        lib/producer.ex:50: Amqpx.Producer.init/1
        (stdlib) gen_server.erl:374: :gen_server.init_it/2
        (stdlib) gen_server.erl:342: :gen_server.init_it/6
        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Description of issue

  • What are the expected results? Amqpx.Producer.start_link(Application.get_env(:amqpx, :producer)) should load the config, also described in rel/config.exs If I replace eval --mfa with command it works fine
  • What version of Distillery? 2.0.14
  • What OS, Erlang/Elixir versions are you seeing this issue on? Elixir 1.8.2 (compiled with Erlang/OTP 21)
  • If possible, also provide your rel/config.exs, as it is often my first troubleshooting question, and you'll save us both time :)
set(
    config_providers: [
      {Mix.Releases.Config.Providers.Elixir, ["${RELEASE_ROOT_DIR}/config/runtime.exs"]}
    ]
  )

  set(
    overlays: [
      {:mkdir, "config"},
      {:copy, "config/secrets.yml", "config/secrets.yml"},
      {:copy, "rel/config/#{Mix.env()}.exs", "config/runtime.exs"}
    ]
  )

michelangelomo avatar Sep 13 '19 16:09 michelangelomo