Raxol.Config (Raxol v2.0.1)
View SourceUnified TOML-based configuration management for Raxol.
This module provides a centralized configuration system that:
- Loads configuration from TOML files
- Supports environment-specific configs
- Provides runtime configuration updates
- Validates configuration values
- Supports default values and overrides
Summary
Functions
Gets the entire configuration map.
Returns a specification to start this module under a supervisor.
Exports current configuration to a TOML file.
Gets a configuration value by path.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Loads configuration from a TOML file.
Reloads all configuration files.
Sets a configuration value at runtime.
Starts the configuration server.
Validates the current configuration.
Types
Functions
@spec all() :: config_map()
Gets the entire configuration map.
Returns a specification to start this module under a supervisor.
See Supervisor.
Exports current configuration to a TOML file.
@spec get( config_path(), keyword() ) :: config_value()
Gets a configuration value by path.
Examples
# Get terminal width
Config.get([:terminal, :width])
# Get with default value
Config.get([:terminal, :custom], default: 80)
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_call/3.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
@spec load_file(String.t()) :: {:ok, config_map()} | {:error, any()}
Loads configuration from a TOML file.
@spec reload() :: :ok | {:error, any()}
Reloads all configuration files.
@spec set(config_path(), config_value()) :: :ok
Sets a configuration value at runtime.
Examples
Config.set([:terminal, :width], 120)
@spec start_link_legacy(keyword()) :: GenServer.on_start()
Starts the configuration server.
@spec validate() :: {:ok, :valid} | {:error, [String.t()]}
Validates the current configuration.