Liking cljdoc? Tell your friends :D

wagoe.core.config.feature-flags

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
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
raw docstring

add-flags-to-configclj

(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
sourceraw docstring

all-flagsclj

(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}
sourceraw docstring

enabled?clj

(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.
sourceraw docstring

flag-infoclj

(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
sourceraw docstring

get-env-valueclj

(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
sourceraw docstring

known-flagsclj

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
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
sourceraw docstring

parse-boolclj

(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
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close