fix: get env from multiple sources
All checks were successful
continuous-integration/drone/pr Build is passing

Rename function and return the first non nil value.
This commit is contained in:
João Paulo Dubas 2024-09-25 10:44:57 +00:00
parent dd623a0547
commit 58c010f486
No known key found for this signature in database

View File

@ -30,9 +30,15 @@ import Config
config :wabanex, dns_cluster_query: System.get_env("DNS_CLUSTER_QUERY") || :ignore
get_multi_env = fn varnames, default ->
multi_get_env = fn varnames, default ->
varnames
|> Enum.reduce(nil, &(System.get_env(&1) || &2))
|> Enum.reduce(nil, fn
varname, nil ->
System.get_env(varname) || nil
_varname, value ->
value
end)
|> Kernel.||(default)
end