Expand description
Canonical truthy/falsy flag parsing for Dynamo.
Single owner of the boolean vocabulary accepted from user-supplied
configuration (environment variables, HTTP headers, config values):
truthy = 1 | true | on | yes, falsy = 0 | false | off | no or empty,
case-insensitive, surrounding whitespace ignored.
dynamo_runtime::config re-exports these helpers and is the canonical
import path for crates that already depend on dynamo-runtime. Crates that
cannot (e.g. dynamo-memory, dynamo-kv-router, dynamo-mocker) depend on
this crate directly. Do not hand-roll new bool parsers — a divergent
accepted set means SOMEFLAG=on works for one flag and silently not
another. tests/no_bool_parse_forks.rs greps the workspace for forks.
Functions§
- env_
is_ falsey - Check if an environment variable is set to a falsey value (including set but empty). Unset (or non-unicode) variables are not falsey.
- env_
is_ truthy - Check if an environment variable is set to a truthy value. Unset (or non-unicode) variables are not truthy.
- is_
falsey - Check if a string is falsey:
0 | false | off | noor empty, case-insensitive, surrounding whitespace ignored. - is_
truthy - Check if a string is truthy:
1 | true | on | yes, case-insensitive, surrounding whitespace ignored. Everything else is not truthy. - parse_
bool - Parse a string as a boolean value, returning an error if it is neither truthy nor falsey.
- parse_
bool_ opt - Tri-state parse for call sites that preserve their own default unless the value is a deliberate boolean choice.