Config utilities
- class duetector.config.Config(config_dict: dict[str, Any] | None = None)[source]
A wrapper for config dict
All config keys are lower case.
Access config by
config.keyand get all config byconfig._config_dict.
- class duetector.config.ConfigLoader(path: str | Path | None = None, load_env: bool = True, dump_when_load=True, config_dump_dir=None, generate_config=True)[source]
A loader for config file and environment variables.
- config_path
Path to config file.
- Type:
Path
- load_env
Load environment variables or not.
- Type:
bool
- dump_when_load
Dump current config to a tmp file when load config.
- Type:
bool
- config_dump_dir
Directory to dump config.
- Type:
str
- DUMP_DIR = '/tmp'
- ENV_PREFIX = 'DUETECTOR_'
- ENV_SEP = '__'
- class duetector.config.Configuable(config: Config | dict[str, Any] | None = None, *args, **kwargs)[source]
A base class for all configuable classes.
It’s recommended to use CLI to generate config file as
config_scopemay be maskedmanager.- default_config
default config for this class
- Type:
Dict[str, Any]
- config_scope
config scope for this class, e.g.
tracer,collector- Type:
str
- config_scope: str | None = None
- default_config = {}