Foundation.Logic.ConfigLogic (foundation v0.1.0)
Pure business logic functions for configuration operations.
Contains configuration manipulation, merging, and transformation logic. No side effects - all functions are pure and easily testable.
Summary
Functions
Build a configuration from environment and options.
Create a configuration diff between two configs.
Get a configuration value by path.
Merge configuration with environment overrides.
Merge configuration with keyword list overrides.
Reset configuration to defaults.
Check if a configuration path can be updated at runtime.
Get the list of paths that can be updated at runtime.
Update a configuration value at the given path. Returns the updated configuration if successful.
Types
Functions
@spec build_config(keyword()) :: {:ok, Foundation.Types.Config.t()} | {:error, Foundation.Types.Error.t()}
Build a configuration from environment and options.
@spec diff_configs(Foundation.Types.Config.t(), Foundation.Types.Config.t()) :: map()
Create a configuration diff between two configs.
@spec get_config_value(Foundation.Types.Config.t(), config_path()) :: {:ok, config_value()} | {:error, Foundation.Types.Error.t()}
Get a configuration value by path.
@spec merge_env_config( Foundation.Types.Config.t(), keyword() ) :: Foundation.Types.Config.t()
Merge configuration with environment overrides.
@spec merge_opts_config( Foundation.Types.Config.t(), keyword() ) :: Foundation.Types.Config.t()
Merge configuration with keyword list overrides.
@spec reset_config() :: Foundation.Types.Config.t()
Reset configuration to defaults.
@spec updatable_path?(config_path()) :: boolean()
Check if a configuration path can be updated at runtime.
@spec updatable_paths() :: [[atom(), ...], ...]
Get the list of paths that can be updated at runtime.
@spec update_config(Foundation.Types.Config.t(), config_path(), config_value()) :: {:ok, Foundation.Types.Config.t()} | {:error, Foundation.Types.Error.t()}
Update a configuration value at the given path. Returns the updated configuration if successful.