Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle falsey return values from sources #17

Open
lundybernard opened this issue Nov 8, 2022 · 1 comment
Open

Handle falsey return values from sources #17

lundybernard opened this issue Nov 8, 2022 · 1 comment

Comments

@lundybernard
Copy link
Owner

if value := source.get(key, path):

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 Found None.

Test Cases:

  • Yaml File sources should be able to set boolean False and None values.
  • Default True values should be over-written by False values that are set in a higher priority source
@lundybernard
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant