Closed bessey closed 1 year ago
I expect AppConfig.new.extra_valid_hosts to return [] because I have explicitly told AnywayConfig that its an array type.
I think, nil
is expected here, since it's the absence of the value, not an empty one. It can have a different meaning (e.g., if you want to implement a custom fallback option). And we coerce provided values; if nothing is provided, we cannot do anything.
In your cases, providing a default value should work as expected:
class AppConfig < Anyway::Config
attr_config(
extra_valid_hosts: []
)
end
What did you do?
Given this config:
And nothing setting the value of
APP_EXTRA_VALID_HOSTS
...What did you expect to happen?
I expect
AppConfig.new.extra_valid_hosts
to return[]
because I have explicitly told AnywayConfig that its an array type.What actually happened?
It returns
nil
Environment
Ruby Version: 3.1
Framework Version (Rails, whatever): Rails 6.1
Anyway Config Version: 2.3.1