Open lundybernard opened 1 year ago
Proposed solution: We will only officially support String values in configuration sources. Converting string values to other types will be the responsibility of the application.
This is more aligned with Environment Variable, and CLI sources, and seems to be common among other configuration storage services.
We will not actively prevent custom sources from returning non-string values, but Falsey values will continue to be a known problem if you choose to do so.
We may consider a more complex solution, raising exceptions instead of returning None
, in the future if a compelling use-case presents its self.
https://github.com/lundybernard/batconf/blob/412297bfa4af6572303d772e907ced32f1ab1a6b/batconf/source.py#L27
Currently, if a source returns a falsey value (False, None, 0, etc.) it will be ignored, and we will continue on to the next source. Falsey values can be valid configuration options, so we need to distinguish a valid
None
value in a config from a value Not FoundNone
.Test Cases:
False
andNone
values.True
values should be over-written byFalse
values that are set in a higher priority source