ConfigurationManager¶
Configuration storage and merge manager.
🔍 API¶
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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
Path | None
|
Optional path to configuration file. Defaults to ~/.ezpl/config.json |
None
|
Attributes¶
Functions¶
get
¶
Get a configuration value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key |
required |
default
|
Any
|
Default value if key not found |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Configuration value or default |
has_key
¶
Check if a configuration key is explicitly set (not just a default).
A key is considered explicit when it comes from a config file, an environment variable, or a direct call to configure()/set()/update(). Keys that are present only because of default values return False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key to check |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the key was explicitly set, False if it is only a default. |
get_all
¶
Get all configuration values.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing all configuration values |
set
¶
Set a configuration value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
Configuration key |
required |
value
|
Any
|
Configuration value |
required |
update
¶
Update configuration with new values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_dict
|
dict[str, Any]
|
Dictionary of configuration values to update |
required |
save
¶
Save current configuration to file.
Raises:
| Type | Description |
|---|---|
FileOperationError
|
If unable to write to configuration file |
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.
export_to_script
¶
Export configuration as environment variables script.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_file
|
str | Path
|
Path to output script file |
required |
platform
|
str | None
|
Target platform ('windows', 'unix', or None for auto-detect) |
None
|
Raises:
| Type | Description |
|---|---|
FileOperationError
|
If unable to write to output file |