Configuration Management
Relevant source files
The following files were used as context for generating this wiki page:
The Configuration Management system in flext-target-oracle-oic provides a robust, type-safe framework for managing runtime settings, authentication credentials, and environment-driven overrides. It leverages Pydantic-based models to ensure that all parameters required for connecting to the Oracle Integration Cloud (OIC) are validated before execution.
This system is central to the project's operation, governing how the Singer Target initializes its state, authenticates against OAuth2 providers, and interacts with OIC APIs. By using a centralized settings class, the project maintains a single source of truth for all configurable behaviors.
Sources: src/flext_target_oracle_oic/settings.py:1-15, src/flext_target_oracle_oic/utilities.py:1-20
Core Configuration Architecture
The architecture relies on the FlextTargetOracleOicSettings class, which inherits from FlextSettingsBase. This structure allows the application to automatically ingest configuration from environment variables using a specific prefix and provides built-in validation for nested data structures.
Settings Model and Environment Integration
The configuration is strictly typed and supports environment variable overrides. Variables are expected to be prefixed with FLEXT_TARGET_ORACLE_OIC_.
The diagram above illustrates the flow of configuration data from external sources into the validated settings object used by system components.
Sources: src/flext_target_oracle_oic/settings.py:18-24, src/flext_target_oracle_oic/utilities.py:114-125
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
oauth_client_id | str | Required | OAuth client identifier for OIC access. |
oauth_client_secret | SecretStr | Required | Sensitive OAuth client secret value. |
oauth_token_url | str | Required | The URL endpoint to request OAuth2 tokens. |
oauth_scope | str | None | c.TargetOracleOic.DEFAULT_OAUTH_SCOPE | Scope for token requests. |
oauth_client_aud | str | None | None | Optional audience for the OAuth provider. |
timeout | int | c.DEFAULT_TIMEOUT_SECONDS | HTTP request timeout in seconds (min: 1). |
Sources: src/flext_target_oracle_oic/settings.py:26-51
Authentication Configuration Logic
Authentication is managed via an internal Authenticator class that uses the validated settings to perform OAuth2 client credential flows.
Token Request Flow
The system builds a specific payload for the oauth_token_url using the configured client credentials and optional scopes or audiences.
The sequence diagram shows how the Authenticator interacts with the Settings model to securely retrieve secrets and execute the OAuth2 handshake.
Sources: src/flext_target_oracle_oic/utilities.py:72-105, tests/unit/test_target.py:89-100
Validation Mechanisms
The project employs two layers of validation:
- Structural Validation: Handled by Pydantic in the
FlextTargetOracleOicSettingsclass. - Runtime Logic Validation: Handled by the
TargetOracleOic.Validationhelper, which ensures mandatory keys are present in generic mappings.
Validation Logic Implementation
@staticmethod
def validate_config(settings: t.ConfigurationMapping) -> p.Result[bool]:
"""Validate required OIC target configuration keys."""
required = {"base_url", "oauth_client_id", "oauth_client_secret"}
missing = sorted(key for key in required if key not in settings)
if missing:
return r[bool].fail(f"Missing required settings fields: {missing}")
return r[bool].ok(value=True)
Sources: src/flext_target_oracle_oic/utilities.py:27-33
Integration with Singer SDK
The configuration management system integrates with the singer-sdk by generating JSON schemas from the Pydantic models. This allows the target to advertise its required configuration to orchestrators like Meltano.
| Component | Responsibility | Derived From |
|---|---|---|
| Config Schema | Generating Singer-compliant JSON schema. | FlextTargetOracleOicSettings.model_json_schema() |
| Target Setup | Initializing the target state and validating input. | FlextTargetOracleOic.setup() |
| E2E Testing | Validating configuration against real environment variables. | tests/unit/test_e2e.py |
Sources: tests/unit/test_e2e.py:34-45, tests/unit/test_target.py:82-87, src/flext_target_oracle_oic/utilities.py:130-133
Summary
Configuration Management in this repository is characterized by a strong emphasis on type safety and automated validation. By utilizing pydantic-settings and centralized utility factories, the system ensures that complex OAuth2 configurations and OIC-specific parameters are correctly applied across all target sinks and authentication workflows. This structure facilitates both local development (via .env files and environment overrides) and enterprise deployment (via structured configuration objects).