nat.llm.utils.env_config_value#
Classes#
Sources from which an environment-backed config value can be loaded. |
|
A wrapper for a string used as a configuration value which can be loaded from the system environment or injected via |
Module Contents#
- class EnvConfigValueSource(*args, \*\*kwds)#
Bases:
enum.EnumSources from which an environment-backed config value can be loaded.
- ENV_DEFAULT = 1#
- CONSTRUCTOR = 2#
- ENV_OVERRIDE = 3#
- class EnvConfigValue(value: str | None = None, use_env: bool = True)#
Bases:
abc.ABCA wrapper for a string used as a configuration value which can be loaded from the system environment or injected via the constructor. This class should be subclassed and the class fields
_ENV_KEYand_ENV_KEY_OVERRIDEcan be set to enable environment-loading functionality. Convienience properties are available to check from where the value was loaded.Parameters#
- valuestr, optional
The value to be contained in the EnvConfigValue. If the value is
None, an attempt will be made to load it from the environment using_ENV_KEY. if the_ENV_KEY_OVERRIDEfield is notNone, an attempt will be made to load that environment variable in place of the passed-in value.- use_envbool
If False, all environment-loading logic will be bypassed and the passed-in value will be used as-is. defaults to True.
- _source#
- _value = None#
- _use_env = True#
- property source: EnvConfigValueSource#