I have configuration where I want to pass boolean and integer variables as env.
BOOLEAN_VARIABLE=false
INTEGER_VARIABLE=5000
I also have default configuration that I want to set if given env variable is not found.
Here I am setting default value of boolean_variable to true and for integer_variable default value is 2000.
boolean_variable =
case System.get_env("BOOLEAN_VARIABLE") do
"false" -> false
_ -> true
end
integer_variable =
case System.get_env("INTEGER_VARIABLE") do
nil -> 2000
value -> String.to_integer(value)
end
I have ended up with dozens of calls in configuration while parsing these variables in config.exs. I was curious if there is better way to have this configuration.