Feature flag management for gradual rollout of new functionality.
This namespace provides pure functions for checking feature flags based on environment variables and configuration.
The environment map is always a parameter. Each of these functions used to
have a convenience arity that called (System/getenv) itself, in a
namespace whose own docstring promised no side effects — so the promise and
the code disagreed, and every caller of a 1-arity was reading ambient
process state from the functional core (BOU-302). The convenience lives in
wagoe.platform.shell.feature-flags, which is a shell namespace and may
read the environment.
Design Principles:
Feature flag management for gradual rollout of new functionality. This namespace provides pure functions for checking feature flags based on environment variables and configuration. The environment map is always a parameter. Each of these functions used to have a convenience arity that called `(System/getenv)` itself, in a namespace whose own docstring promised no side effects — so the promise and the code disagreed, and every caller of a 1-arity was reading ambient process state from the functional core (BOU-302). The convenience lives in `wagoe.platform.shell.feature-flags`, which is a shell namespace and may read the environment. Design Principles: - Pure functions: No side effects, configuration passed as parameter - Explicit defaults: Clear behavior when flag not set - Type-safe: Boolean coercion with validation - Backward compatible: Defaults to false for new features
(add-flags-to-config config env-map)Add feature flags to application configuration.
Args: config: Application configuration map env-map: Environment map
Returns: Configuration map with :feature-flags added
Add feature flags to application configuration. Args: config: Application configuration map env-map: Environment map Returns: Configuration map with :feature-flags added
(all-flags env-map)Get status of all known feature flags.
Args: env-map: Environment map
Returns: Map of flag-key -> boolean status
Example: (all-flags {"WAG_DEVEX_VALIDATION" "true"}) => {:devex-validation true, :structured-logging false}
Get status of all known feature flags.
Args:
env-map: Environment map
Returns:
Map of flag-key -> boolean status
Example:
(all-flags {"WAG_DEVEX_VALIDATION" "true"})
=> {:devex-validation true, :structured-logging false}(enabled? flag-key env-map)Check if a feature flag is enabled.
Args: flag-key: Feature flag keyword (from known-flags) env-map: Environment map
Returns: Boolean indicating if feature is enabled
Example: (enabled? :devex-validation {"WAG_DEVEX_VALIDATION" "true"}) => true
To ask about the real environment, call
wagoe.platform.shell.feature-flags/enabled?, which fetches it first.
Check if a feature flag is enabled.
Args:
flag-key: Feature flag keyword (from known-flags)
env-map: Environment map
Returns:
Boolean indicating if feature is enabled
Example:
(enabled? :devex-validation {"WAG_DEVEX_VALIDATION" "true"})
=> true
To ask about the real environment, call
`wagoe.platform.shell.feature-flags/enabled?`, which fetches it first.(flag-info flag-key env-map)Get information about a specific flag.
Args: flag-key: Feature flag keyword env-map: Environment map
Returns: Map with :enabled?, :env-var, :description
Get information about a specific flag. Args: flag-key: Feature flag keyword env-map: Environment map Returns: Map with :enabled?, :env-var, :description
(get-env-value env-var env-map)Look up env-var in env-map.
Args: env-var: Environment variable name env-map: Map of environment variables
Returns: String value or nil
Look up `env-var` in `env-map`. Args: env-var: Environment variable name env-map: Map of environment variables Returns: String value or nil
Registry of known feature flags with metadata.
Each flag includes:
Registry of known feature flags with metadata. Each flag includes: - :env-var - Environment variable name - :default - Default value if not set - :description - Human-readable description
(parse-bool value)Parse string value to boolean.
Args: value: String value from environment
Returns: Boolean value
Truthy values: "true", "1", "yes", "on" (case-insensitive) Falsy values: Everything else
Parse string value to boolean. Args: value: String value from environment Returns: Boolean value Truthy values: "true", "1", "yes", "on" (case-insensitive) Falsy values: Everything else
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |