Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config() returns nil when resolving configuration fails #45

Open
indrekj opened this issue Sep 20, 2019 · 0 comments
Open

config() returns nil when resolving configuration fails #45

indrekj opened this issue Sep 20, 2019 · 0 comments

Comments

@indrekj
Copy link

indrekj commented Sep 20, 2019

The comment https://github.com/Nebo15/confex/blob/master/lib/confex.ex#L314 says that ArgumentError is raised when configuration cannot be resolved. This however is not true.

Here you can see the configuration:

iex(1)> {:ok, c} = Application.fetch_env(:transporter, Transporter.ProxyRequests.Process)
{:ok,
 [
   bypass: %{
     ~r/\/\/client-logger\..*/ => %{
       host: {:system, "CLIENT_LOGGER_SERVICE_HOST"},
       port: 80,
       scheme: "http"
     }
   }
 ]}

CLIENT_LOGGER_SERVICE_HOST env var is not actually set.

If I use use Confex, otp_app: :transporter macro, then Transporter.ProxyRequests.Process.config() returns just nil.

I think this is because Confex is using get_env https://github.com/Nebo15/confex/blob/master/lib/confex.ex#L319 which defaults to nil on error.

Feel free to close this ticket if this behavior is expected. It caused us a small incident because one of the env vars was missing and it didn't fail fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant