Raxol.Core.Config.Manager (Raxol v0.5.0)
View SourceConfiguration manager for the Raxol Terminal Emulator. Provides a unified interface for managing all configuration options, including loading, validation, and runtime updates.
Summary
Functions
Returns a specification to start this module under a supervisor.
Deletes a configuration value.
Gets a configuration value.
Gets all configuration values.
Reloads configuration from the file.
Sets a configuration value.
Starts the configuration manager.
Updates a configuration value using a function.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Deletes a configuration value.
Parameters
key
- The configuration keyopts
- Additional options:persist
- Whether to persist the deletion (default: true)
Returns
:ok
- If the value was deleted successfully{:error, reason}
- If the value could not be deleted
Gets a configuration value.
Parameters
key
- The configuration keydefault
- Default value if key is not found (optional)
Returns
- The configuration value or default
Gets all configuration values.
Returns
- Map of all configuration values
Reloads configuration from the file.
Returns
:ok
- If the configuration was reloaded successfully{:error, reason}
- If the configuration could not be reloaded
Sets a configuration value.
Parameters
key
- The configuration keyvalue
- The configuration valueopts
- Additional options:validate
- Whether to validate the value (default: true):persist
- Whether to persist the value (default: true)
Returns
:ok
- If the value was set successfully{:error, reason}
- If the value could not be set
Starts the configuration manager.
Options
:config_file
- Path to the configuration file (default: "config/raxol.exs"):env
- Environment to load (default: Mix.env()):validate
- Whether to validate configuration (default: true)
Returns
{:ok, pid}
- If the manager starts successfully{:error, reason}
- If the manager fails to start
Updates a configuration value using a function.
Parameters
key
- The configuration keyfun
- Function to update the valueopts
- Additional options:validate
- Whether to validate the value (default: true):persist
- Whether to persist the value (default: true)
Returns
:ok
- If the value was updated successfully{:error, reason}
- If the value could not be updated