ConfigurationManager¶
Configuration management for ezpl.
Overview¶
The ConfigurationManager class manages configuration from multiple sources (environment variables, config file, defaults) with a clear priority order.
Class Reference¶
ConfigurationManager
¶
Centralized configuration manager for Ezpl.
This class handles all configuration operations including loading, saving, and merging configuration from multiple sources.
Initialize the configuration manager.
| PARAMETER | DESCRIPTION |
|---|---|
config_file
|
Optional path to configuration file. Defaults to ~/.ezpl/config.json
TYPE:
|
Source code in src/ezpl/config/manager.py
Attributes¶
Functions¶
get
¶
Get a configuration value.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
Configuration key
TYPE:
|
default
|
Default value if key not found
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
Configuration value or default |
Source code in src/ezpl/config/manager.py
has_key
¶
Check if a configuration key is explicitly set (not just a default).
| PARAMETER | DESCRIPTION |
|---|---|
key
|
Configuration key to check
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the key is explicitly set in config or environment, False otherwise |
Source code in src/ezpl/config/manager.py
get_log_level
¶
get_log_file
¶
Get the current log file path.
Source code in src/ezpl/config/manager.py
get_printer_level
¶
get_file_logger_level
¶
get_indent_step
¶
get_indent_symbol
¶
get_base_indent_symbol
¶
get_log_format
¶
get_log_rotation
¶
get_log_retention
¶
get_log_compression
¶
get_all
¶
Get all configuration values.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, Any]
|
Dictionary containing all configuration values |
set
¶
Set a configuration value.
| PARAMETER | DESCRIPTION |
|---|---|
key
|
Configuration key
TYPE:
|
value
|
Configuration value
TYPE:
|
update
¶
Update configuration with new values.
| PARAMETER | DESCRIPTION |
|---|---|
config_dict
|
Dictionary of configuration values to update
TYPE:
|
save
¶
Save current configuration to file.
| RAISES | DESCRIPTION |
|---|---|
FileOperationError
|
If unable to write to configuration file |
Source code in src/ezpl/config/manager.py
reset_to_defaults
¶
reload
¶
Reload configuration from file and environment variables.
This method reloads the configuration, useful when environment variables or the config file have changed after initialization.
Source code in src/ezpl/config/manager.py
export_to_script
¶
Export configuration as environment variables script.
| PARAMETER | DESCRIPTION |
|---|---|
output_file
|
Path to output script file
TYPE:
|
platform
|
Target platform ('windows', 'unix', or None for auto-detect)
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
FileOperationError
|
If unable to write to output file |