dot_env_variable_loader
File: core/src/utcp/data/variable_loader_implementations/dot_env_variable_loader.py
class DotEnvVariableLoader (VariableLoader)
Documentation
Environment file variable loader implementation.
Loads variables from .env files using the dotenv format. This loader supports the standard key=value format with optional quoting and comment support provided by the python-dotenv library.
Attributes
env_file_path
: Path to the .env file to load variables from.
Example
loader = DotEnvVariableLoader(env_file_path=".env")
api_key = loader.get("API_KEY")
Fields:
- variable_loader_type: Literal['dotenv']
- env_file_path: str
Methods:
get(self, key: str) -> Optional[str]
Load a variable from the configured .env file.
Args
key
: Variable name to retrieve from the environment file.
Returns
Variable value if found in the file, None otherwise.
class DotEnvVariableLoaderSerializer (Serializer[DotEnvVariableLoader])
No class documentation available
Methods:
to_dict(self, obj: DotEnvVariableLoader) -> dict
Convert a DotEnvVariableLoader object to a dictionary.
Args
obj
: The DotEnvVariableLoader object to convert.
Returns
The dictionary converted from the DotEnvVariableLoader object.
validate_dict(self, data: dict) -> DotEnvVariableLoader
Validate a dictionary and convert it to a DotEnvVariableLoader object.
Args
data
: The dictionary to validate and convert.
Returns
The DotEnvVariableLoader object converted from the dictionary.