ciberlabreport.settings module

Configuration loading utilities for ciberlabreport entrypoints.

This module provides a small settings loader that combines:
  1. Optional environment file values.

  2. Base YAML configuration.

  3. Profile-specific YAML configuration.

  4. Environment variable overrides.

The resulting settings object can be passed directly to ReportGenerator from external scripts.

class ciberlabreport.settings.AppSettings(openai_api_key: str, vt_api_keys: list[str], input_path_default: str | None, output_path_default: str | None, config_path: str | None, prompts_path: str | None, schemas_path: str | None, tmp_path: str | None, ai_model: str, mode: str, img_threshold: int, max_files: int, max_completion_tokens: int, families_list: list[str])

Bases: object

Runtime settings resolved from YAML and environment variables.

openai_api_key

OpenAI API key used by the report generator.

Type:

str

vt_api_keys

VirusTotal API keys for enrichment lookups.

Type:

list[str]

input_path_default

Default input directory.

Type:

str | None

output_path_default

Default output directory.

Type:

str | None

config_path

Base directory for JSON configurations.

Type:

str | None

prompts_path

Prompt templates directory.

Type:

str | None

schemas_path

JSON schema directory.

Type:

str | None

tmp_path

Temporary output directory.

Type:

str | None

ai_model

LLM model identifier.

Type:

str

mode

Runtime mode (for example, PRO or DEV).

Type:

str

img_threshold

Image threshold used in processing logic.

Type:

int

max_files

Maximum number of JSON files processed per run.

Type:

int

max_completion_tokens

LLM output token cap.

Type:

int

ai_model: str
config_path: str | None
families_list: list[str]
img_threshold: int
input_path_default: str | None
max_completion_tokens: int
max_files: int
mode: str
openai_api_key: str
output_path_default: str | None
prompts_path: str | None
schemas_path: str | None
tmp_path: str | None
vt_api_keys: list[str]
ciberlabreport.settings.load_settings() AppSettings

Load and resolve application settings for execution entrypoints.

Resolution order:
  1. Optional environment file from CIBERLABREPORT_ENV_FILE.

  2. Base YAML file from CIBERLABREPORT_CONF_FILE (default: config/base.yaml).

  3. Profile YAML file under profiles/<profile>.yaml where profile comes from CIBERLABREPORT_PROFILE (default: local).

  4. Environment variable overrides for selected fields.

Returns:

Fully resolved settings object.

Return type:

AppSettings

Raises:

ValueError – If OPENAI_API_KEY is missing.