Tap Settings & Environment
Relevant source files
The following files were used as context for generating this wiki page:
The Tap Settings & Environment module provides the configuration backbone for the flext-tap-ldap project. It defines the structured schema for LDAP connection parameters, search behaviors, and processing rules for both live directory services and LDIF file extraction. By utilizing Pydantic models and Singer-compatible JSON schemas, the tap ensures rigorous validation of input settings before execution.
This system facilitates the translation of raw environment variables and configuration files into actionable parameters for the LDAPClient. It manages the lifecycle of settings from initial CLI invocation through to stream discovery and record extraction.
Configuration Architecture
The configuration logic is distributed across three primary areas: the FlextTapLdapTap class for Singer protocol compliance, the FlextTapLdapModels for internal data validation, and the FlextTapLdapSettings for environment handling.
Configuration Flow
The following diagram illustrates how raw configuration is ingested and validated to initialize the tap components.
The tap uses a unified config_jsonschema to communicate requirements to the Singer ecosystem while utilizing internal models for type-safe processing.
Sources: src/flext_tap_ldap/tap.py:53-110, src/flext_tap_ldap/models.py:57-93
Core Configuration Parameters
The tap supports a comprehensive set of settings categorized by connectivity, search behavior, and file processing.
Connection Settings
These parameters define how the tap authenticates and connects to the LDAP server.
| Parameter | Type | Default | Description |
|---|---|---|---|
host | string | N/A | LDAP server hostname or IP address. |
port | integer | 389 | The port used for the LDAP connection. |
bind_dn | string | None | Distinguished Name used for authentication. |
password | string | None | Password associated with the Bind DN. |
use_ssl | boolean | False | Whether to use SSL/TLS for the connection. |
timeout_seconds | integer | 30 | Search timeout duration in seconds. |
Sources: src/flext_tap_ldap/tap.py:64-78, src/flext_tap_ldap/models.py:59-93
Stream & Search Behavior
Controls how the tap identifies and filters records from the directory.
| Parameter | Type | Default | Description |
|---|---|---|---|
base_dn | string | None | The starting point for LDAP search operations. |
page_size | integer | 1000 | Number of results per page for paged searches. |
user_filter | string | (objectClass=inetOrgPerson) | Filter used for identifying user records. |
group_filter | string | (objectClass=groupOfNames) | Filter used for identifying group records. |
custom_streams | array | [] | Definitions for non-standard LDAP search streams. |
Sources: src/flext_tap_ldap/tap.py:79-93, src/flext_tap_ldap/streams.py:183-188
Data Models and Validation
The tap leverages FlextTapLdapModels (aliased as m) to enforce strict typing on configuration data. This ensures that runtime errors related to malformed configuration are caught early during the initialization phase.
LdapConnectionParams Class
This model serves as the primary validator for the connection block within the tap settings.
class LdapConnectionParams(m.Value):
"""LDAP connection parameters for tap configuration."""
host: t.NonEmptyStr = u.Field(description="LDAP server hostname")
port: t.PortNumber = u.Field(description="LDAP server port")
bind_dn: Annotated[str | None, u.Field(description="Bind DN for authentication")] = None
bind_password: Annotated[str | None, u.Field(description="Bind password for authentication")] = None
use_ssl: bool = u.Field(description="Enable SSL")
page_size: Annotated[t.PositiveInt, u.Field(default=1000)]
Sources: src/flext_tap_ldap/models.py:59-83
Custom Stream Definitions
Users can define custom search streams through the custom_streams configuration. Each entry must provide a name and can optionally specify a search_filter and primary_keys.
The validate_custom_stream method in the tap ensures that these definitions contain at least a valid name before they are added to the catalog during discovery.
Sources: src/flext_tap_ldap/tap.py:169-181, src/flext_tap_ldap/models.py:44-55
Environment and Dependency Context
The project environment is managed via pyproject.toml, which specifies the Python runtime requirement (3.13+) and core dependencies.
- Core Dependencies:
flext-core,flext-ldap,flext-meltano, andpydantic. - CLI Commands: The tap exposes
flext-tap-ldapandtap-ldapas entry points. - Prefixes: Environment variables are prefixed based on the
FlextSettingsconfiguration, typically following theFLEXT_TAP_LDAP_pattern.
Sources: pyproject.toml:28-35, 96-98, README.md:21-25
Conclusion
The Tap Settings & Environment module ensures that flext-tap-ldap operates with validated, type-safe configurations. By combining JSON Schema for external protocol compatibility and Pydantic models for internal logic, the system provides a robust framework for managing LDAP connection strings, search filters, and file-based processing parameters.