Skip to content

OSSS.config.app_configs

OSSS.config.app_configs

Application Configuration Management for OSSS.

This module provides centralized configuration management for all application constants, timeouts, paths, and operational parameters previously scattered throughout the codebase as magic numbers.

LogLevel

Bases: Enum

Enumeration for log levels.

Environment

Bases: Enum

Enumeration for deployment environments.

AppExecutionConfig

Bases: BaseModel

Configuration for agent execution and orchestration.

validate_default_agents(v) classmethod

Validate default agents list.

FileConfig

Bases: BaseModel

Configuration for file handling and storage.

validate_directory_paths(v) classmethod

Validate and resolve directory paths.

Relative paths are resolved against the project root (where pyproject.toml is located) to prevent nested directory creation when scripts run from subdirectories.

validate_filename_separator(v) classmethod

Validate filename separator character.

ModelConfig

Bases: BaseModel

Configuration for LLM models and providers.

validate_string_fields(v) classmethod

Validate string fields are not empty.

DevelopmentConfig

Bases: BaseModel

Configuration for testing and development.

validate_mock_history_entries(v) classmethod

Validate mock history entries.

validate_prompt_max_length(v, info) classmethod

Validate that max length is greater than min length.

ApplicationConfig

Bases: BaseModel

Main application configuration containing all subsystem configurations.

This class serves as the central point for all configuration management, consolidating previously scattered magic numbers and constants.

from_env() classmethod

Create configuration from environment variables.

Returns

ApplicationConfig Configuration instance populated from environment variables

from_file(config_path) classmethod

Create configuration from a JSON configuration file.

Parameters

config_path : str Path to the JSON configuration file

Returns

ApplicationConfig Configuration instance populated from file

Raises

FileNotFoundError If the configuration file doesn't exist json.JSONDecodeError If the configuration file is not valid JSON

save_to_file(config_path)

Save configuration to a JSON file.

Parameters

config_path : str Path where to save the configuration file

get_timeout_for_environment()

Get timeout value adjusted for current environment.

Returns

int Timeout in seconds, potentially adjusted for testing

ensure_directories_exist()

Create configured directories if they don't exist.

validate_configuration()

Validate configuration values and return any errors.

Kept for backward compatibility with the original dataclass validation. This method replicates the original validation logic for tests.

Returns

List[str] List of validation error messages, empty if valid

validate_config()

Alias for validate_configuration() method.

Returns

List[str] List of validation error messages, empty if valid

get_config()

Get the global application configuration instance.

Returns

ApplicationConfig The global configuration instance

set_config(config)

Set the global application configuration instance.

Parameters

config : ApplicationConfig The configuration instance to set as global

reset_config()

Reset the global configuration to default values.

load_config_from_file(config_path)

Load configuration from file and set it as global.

Parameters

config_path : str Path to the configuration file

Returns

ApplicationConfig The loaded configuration instance