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

config: Support falsy numeric and boolean values… #746

Merged
merged 5 commits into from
Nov 3, 2023

Commits on Nov 2, 2023

  1. Configuration menu
    Copy the full SHA
    7645ef9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b904e4e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    81ead64 View commit details
    Browse the repository at this point in the history
  4. tests: Demonstrate that falsy values aren't configurable with failing…

    … tests
    
    To be fixed in the next commit.
    
    There's other config behaviours it would likely be useful to test, but
    this is a small start.
    tsibley committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    d3807fd View commit details
    Browse the repository at this point in the history
  5. config: Support falsy numeric and boolean values…

    …instead of considering them missing.
    
    The values considered missing are now more clear:
    
      1. undefined (i.e. not present)
      2. null (i.e. present but explicitly null)
      3. "" (i.e. present but empty, particularly for env vars)
    
    This allows falsy values¹ like the number 0 and boolean false to be
    configurable values², as expected to be for OIDC_IAT_BACKDATED_BY and
    REDIS_REQUIRED.
    
    For example, setting REDIS_REQUIRED=false is now functional as intended
    by "Allow and document how to run safely in production mode without
    Redis" (64f7d92).  And setting OIDC_IAT_BACKDATED_BY=0 in the
    environment now overrides any value from the config file instead of
    being ignored.
    
    Related-to: <#739>
    
    ¹ <https://developer.mozilla.org/en-US/docs/Glossary/Falsy>
    
    ² Other falsy values like NaN and 0n are also now considered
      non-missing, but there's no way to express those in our current config
      sources, which permit only strings or JSON values.  We may find
      ourselves wanting to treat NaN as missing too if config sources
      change.
    tsibley committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    3fccf53 View commit details
    Browse the repository at this point in the history