confex icon indicating copy to clipboard operation
confex copied to clipboard

No default and nil as default aren't the same

Open janpieper opened this issue 4 years ago • 1 comments

Maybe I am wrong, but this doesn't feel to be the truth:

https://github.com/Nebo15/confex/blob/fa436d139c6d7eafd6b25f9b1d31fe2de5075d43/lib/confex.ex#L52

For me, I get an ArgumentError when using {:system, :integer, "ENV_NAME"}:

** (Mix) Could not start application example: exited in: Example.Application.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (ArgumentError) can't fetch value for key `Example.Config` of application `:example`, can not resolve key ENV_NAME value via adapter Elixir.Confex.Adapters.SystemEnvironment

But it works fine when using {:system, :integer, "ENV_NAME", nil}. So, it is not the same.

janpieper avatar Mar 17 '20 08:03 janpieper

@janpieper good catch, feel free to send a PR to fix the documentation. It should raise indeed because often if you don't have defaults you won't want to end up loading invalid configuration.

AndrewDryga avatar Mar 17 '20 16:03 AndrewDryga