bitwalker / bitwalker/distillery

can't access config file with eval

Open
#707 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
3k
Forks
398
PR merge metrics
No merged PRs in 30d

Description

### 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"}
]
)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.