pyoaev.configuration.settings_loader
Module Contents
- class pyoaev.configuration.settings_loader.BaseConfigModel(/, **data: Any)
Bases:
pydantic.BaseModel,abc.ABCBase class for global config models To prevent attributes from being modified after initialization.
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyoaev.configuration.settings_loader.SettingsLoader(_case_sensitive: bool | None = None, _nested_model_default_partial_update: bool | None = None, _env_prefix: str | None = None, _env_file: pydantic_settings.sources.DotenvType | None = ENV_FILE_SENTINEL, _env_file_encoding: str | None = None, _env_ignore_empty: bool | None = None, _env_nested_delimiter: str | None = None, _env_nested_max_split: int | None = None, _env_parse_none_str: str | None = None, _env_parse_enums: bool | None = None, _cli_prog_name: str | None = None, _cli_parse_args: bool | list[str] | tuple[str, Ellipsis] | None = None, _cli_settings_source: pydantic_settings.sources.CliSettingsSource[Any] | None = None, _cli_parse_none_str: str | None = None, _cli_hide_none_type: bool | None = None, _cli_avoid_json: bool | None = None, _cli_enforce_required: bool | None = None, _cli_use_class_docs_for_groups: bool | None = None, _cli_exit_on_error: bool | None = None, _cli_prefix: str | None = None, _cli_flag_prefix_char: str | None = None, _cli_implicit_flags: bool | None = None, _cli_ignore_unknown_args: bool | None = None, _cli_kebab_case: bool | None = None, _cli_shortcuts: collections.abc.Mapping[str, str | list[str]] | None = None, _secrets_dir: pydantic_settings.sources.PathType | None = None, **values: Any)
Bases:
pydantic_settings.BaseSettingsBase class for settings, allowing values to be overridden by environment variables.
This is useful in production for secrets you do not wish to save in code, it plays nicely with docker(-compose), Heroku and any 12 factor app design.
All the below attributes can be set via model_config.
- Args:
- _case_sensitive: Whether environment and CLI variable names should be read with case-sensitivity.
Defaults to None.
- _nested_model_default_partial_update: Whether to allow partial updates on nested model default object fields.
Defaults to False.
_env_prefix: Prefix for all environment variables. Defaults to None. _env_file: The env file(s) to load settings values from. Defaults to Path(‘’), which
means that the value from model_config[‘env_file’] should be used. You can also pass None to indicate that environment variables should not be loaded from an env file.
_env_file_encoding: The env file encoding, e.g. ‘latin-1’. Defaults to None. _env_ignore_empty: Ignore environment variables where the value is an empty string. Default to False. _env_nested_delimiter: The nested env values delimiter. Defaults to None. _env_nested_max_split: The nested env values maximum nesting. Defaults to None, which means no limit. _env_parse_none_str: The env string value that should be parsed (e.g. “null”, “void”, “None”, etc.)
into None type(None). Defaults to None type(None), which means no parsing should occur.
_env_parse_enums: Parse enum field names to values. Defaults to None., which means no parsing should occur. _cli_prog_name: The CLI program name to display in help text. Defaults to None if _cli_parse_args is None.
Otherwise, defaults to sys.argv[0].
- _cli_parse_args: The list of CLI arguments to parse. Defaults to None.
If set to True, defaults to sys.argv[1:].
_cli_settings_source: Override the default CLI settings source with a user defined instance. Defaults to None. _cli_parse_none_str: The CLI string value that should be parsed (e.g. “null”, “void”, “None”, etc.) into
None type(None). Defaults to _env_parse_none_str value if set. Otherwise, defaults to “null” if _cli_avoid_json is False, and “None” if _cli_avoid_json is True.
_cli_hide_none_type: Hide None values in CLI help text. Defaults to False. _cli_avoid_json: Avoid complex JSON objects in CLI help text. Defaults to False. _cli_enforce_required: Enforce required fields at the CLI. Defaults to False. _cli_use_class_docs_for_groups: Use class docstrings in CLI group help text instead of field descriptions.
Defaults to False.
- _cli_exit_on_error: Determines whether or not the internal parser exits with error info when an error occurs.
Defaults to True.
_cli_prefix: The root parser command line arguments prefix. Defaults to “”. _cli_flag_prefix_char: The flag prefix character to use for CLI optional arguments. Defaults to ‘-‘. _cli_implicit_flags: Whether bool fields should be implicitly converted into CLI boolean flags.
(e.g. –flag, –no-flag). Defaults to False.
_cli_ignore_unknown_args: Whether to ignore unknown CLI args and parse only known ones. Defaults to False. _cli_kebab_case: CLI args use kebab case. Defaults to False. _cli_shortcuts: Mapping of target field name to alias names. Defaults to None. _secrets_dir: The secret files directory or a sequence of directories. Defaults to None.
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- classmethod settings_customise_sources(settings_cls: type[pydantic_settings.BaseSettings], init_settings: pydantic_settings.PydanticBaseSettingsSource, env_settings: pydantic_settings.PydanticBaseSettingsSource, dotenv_settings: pydantic_settings.PydanticBaseSettingsSource, file_secret_settings: pydantic_settings.PydanticBaseSettingsSource) tuple[pydantic_settings.PydanticBaseSettingsSource, Ellipsis]
Customise the sources of settings for the connector.
This method is called by the Pydantic BaseSettings class to determine the order of sources. The configuration come in this order either from:
Environment variables
YAML file
.env file
Default values
- The variables loading order will remain the same as in pycti.get_config_variable():
If a config.yml file is found, the order will be: ENV VAR → config.yml → default value
If a .env file is found, the order will be: ENV VAR → .env → default value
- pyoaev.configuration.settings_loader.LogLevelToLower
- pyoaev.configuration.settings_loader.HttpUrlToString
- pyoaev.configuration.settings_loader.TimedeltaInSeconds
- class pyoaev.configuration.settings_loader.ConfigLoaderOAEV(/, **data: Any)
Bases:
BaseConfigModelOpenAEV/OpenAEV platform configuration settings.
Contains URL and authentication token for connecting to the OpenAEV platform.
- url: HttpUrlToString = None
- token: str = None
- class pyoaev.configuration.settings_loader.ConfigLoaderCollector(/, **data: Any)
Bases:
BaseConfigModelBase collector configuration settings.
Contains common collector settings including identification, logging, scheduling, and platform information.
- id: str = None
- name: str = None
- log_level: LogLevelToLower | None = None
- period: datetime.timedelta | None = None
- icon_filepath: str | None = None