An OTP app config with nested data structs evaluates to nil if at least one entry specifies system env var that is not set.
Example:
config :my_app,
var: [
foo: {:system, :string, "FOO"},
bar: "bar-value"
]
Expected:
iex> Confex.get_env(:my_app, :var)
[
foo: nil,
bar: "bar-value"
]
Less expected, but still meaningful:
iex> Confex.get_env(:my_app, :var)
[
bar: "bar-value"
]
Actual:
iex> Confex.get_env(:my_app, :var)
nil
Workaround:
Use 4 element tuple with a default value of nil
config :my_app,
var: [
foo: {:system, :string, "FOO", nil},
bar: "bar-value"
]
####
iex> Confex.get_env(:my_app, :var)
[
foo: nil,
bar: "bar-value"
]
An OTP app config with nested data structs evaluates to
nilif at least one entry specifies system env var that is not set.Example:
Expected:
Less expected, but still meaningful:
Actual:
Workaround:
Use 4 element tuple with a default value of nil