preheat_open.configuration.ConfigBase
- class preheat_open.configuration.ConfigBase
Bases:
objectBase class for all configuration objects.
This class provides common functionality for all configuration classes, including environment variable access and sensitive data handling.
- Attributes:
runtime_mode (int): The current runtime mode
- __init__()
Initialize configuration from environment variables.
Methods
__init__()Initialize configuration from environment variables.
Iterate over all attributes of the configuration object.
pretty_print([anonymize])Create a string representation with sensitive fields masked.
Return a context manager that temporarily sets environment variables.
Attributes
runtime_modeGet a proxy object to update configuration attributes and environment variables.
- class TempContext(config_obj)
Bases:
Generic[T]Context manager for temporarily setting environment variables.
- iter_items()
Iterate over all attributes of the configuration object.
- Return type:
Generator[tuple[str,Any],None,None]
- Yields:
tuple[str, Any]: A tuple of attribute name and value
- pretty_print(anonymize=None)
Create a string representation with sensitive fields masked.
- Return type:
str
- Returns:
str: String representation of the configuration
- temporary()
Return a context manager that temporarily sets environment variables.
- Return type:
TempContext[T]
- Usage:
- with config.temporary():
# Environment variables reflect config values here
# Original environment variables restored here
- Returns:
TempContext: A context manager that preserves the specific config type
- property update: UpdateProxy
Get a proxy object to update configuration attributes and environment variables.