Application Settings & Configuration
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Application Settings & Configuration system for the flext-oracle-oic extension provides a unified, type-safe framework for managing runtime environment variables, authentication credentials, and connection parameters. It follows the FLEXT Unified Class Pattern, centralizing all configuration logic within a single FlextOracleOicSettings class that inherits from FlextSettingsBase. This ensures that all Oracle Integration Cloud (OIC) operations operate with validated, deterministic settings across development, testing, and production environments.
The configuration architecture is designed to support various OIC-specific needs, including OAuth2 client credentials, SSL verification, and enterprise orchestration flags. By leveraging Pydantic-driven validation, the system enforces strict typing and provides sensible defaults derived from centralized constants.
Sources: src/flext_oracle_oic/settings.py:1-20, src/flext_oracle_oic/constants.py:1-15
Core Settings Architecture
The settings are managed primarily through FlextOracleOicSettings, which utilizes an environment prefix FLEXT_ORACLE_OIC_ for all automated variable loading. This class serves as the single source of truth for the OIC client and API facades.
Configuration Hierarchy
The system organizes settings into several logical groups:
- Connection Settings: Base URL, API version, and network timeouts.
- Security & SSL: Flags for SSL usage and certificate verification.
- OAuth2 Authentication: Client IDs, secrets, token URLs, and scopes.
- Feature Flags: Toggles for monitoring, enterprise patterns, and orchestration.
The diagram shows the inheritance from the core library and the key attributes managed by the OIC settings class.
Sources: src/flext_oracle_oic/settings.py:23-50, tests/unit/test_config.py:12-40
Configuration Options & Defaults
The following table summarizes the primary configuration parameters available in the extension.
| Parameter | Type | Default Value | Description |
|---|---|---|---|
base_url | NonEmptyStr | https://localhost.integration.ocp.oraclecloud.com | The root URL for the OIC instance. |
api_version | OICApiVersion | v1 | Target OIC API version (v1 or v2). |
request_timeout | PositiveInt | 30 (from constants) | Maximum time allowed for network requests. |
max_retries | RetryCount | 3 (from constants) | Maximum number of retry attempts for failed requests. |
verify_ssl | bool | True | Whether to verify the server's SSL certificate. |
enable_monitoring | bool | True | Enables health and performance monitoring. |
oauth_token_url | NonEmptyStr | [base_url]/oauth/token | Endpoint for obtaining OAuth2 access tokens. |
Sources: src/flext_oracle_oic/settings.py:35-50, src/flext_oracle_oic/constants.py:77-85
Authentication Configuration Logic
Authentication is handled via OAuth2 Client Credentials. The configuration requires a client_id and a client_secret (stored securely as a SecretStr).
OAuth Flow Configuration
The FlextOracleOicClient uses these settings to generate the necessary headers and payloads for token retrieval.
The sequence diagram illustrates how the configuration values are utilized by the client to perform an OAuth2 handshake.
Sources: src/flext_oracle_oic/ext_client.py:114-130, src/flext_oracle_oic/ext_client.py:270-285
Environment Contexts
The system provides methods to extract specific subsets of the configuration as dictionaries, facilitating context management for different operations.
- Auth Context: Includes client ID, token URL, and scope.
- Connection Context: Includes base URL, API version, and timeout.
- Features Context: Includes feature flags like monitoring and SSL toggles.
# Example of fetching connection context in FlextOracleOicApi
def fetch_connection_context(self) -> p.Result[t.JsonMapping]:
return r[t.JsonMapping].ok({
"base_url": self._oic_config.base_url,
"api_version": self._oic_config.api_version,
"request_timeout": self._oic_config.request_timeout,
})
Sources: src/flext_oracle_oic/api.py:180-200
Validation & Constraints
Configuration values are strictly validated using Pydantic and regex patterns defined in FlextOracleOicConstants.
- Integration Names: Must match
^[a-zA-Z0-9_\-\s]+$and be between 1 and 100 characters. - Version Format: Enforced via
XX.XX.XXXXpattern. - Timeouts: Must be a positive integer (minimum 1 second).
Sources: src/flext_oracle_oic/constants.py:185-205, tests/unit/test_config.py:16-25
Summary
The Application Settings & Configuration system ensures that the flext-oracle-oic extension is robust and easy to configure across different environments. By centralizing settings in FlextOracleOicSettings and utilizing a strict environment variable prefix, the project maintains high standards for security and technical accuracy, particularly regarding sensitive OAuth2 credentials and network communication parameters.