app.util package
Submodules
app.util.edc_helpers module
EDC helpers.
Utility functions to build EDC Management API URLs and to retrieve authentication data for a given connector document.
- Responsibilities:
Compose base management URLs for managed and remote connectors.
Validate and return the API key configured for a connector.
- app.util.edc_helpers.get_base_url(connector, path)
Builds the base Management API URL for a connector and appends a path.
For connectors in managed mode, the URL depends on the deployment type: - If TYPE=localhost (default), it uses localhost and the configured port. - Otherwise, it targets the Docker service name pattern:
edc-{type}-{_id}:{management_port}.
For connectors in remote mode, it uses the endpoints_url.management value provided in the connector document.
- Parameters:
connector (dict) – Connector document (from MongoDB) containing mode, ports.management, type, _id, and/or endpoints_url.management.
path (str) – Path to append to the base management URL (e.g., “/management/v3/assets”).
- Raises:
HTTPException – If the connector mode is invalid.
- Returns:
Fully qualified URL to call the EDC Management API.
- Return type:
str
- app.util.edc_helpers.get_api_key(connector)
Returns the API key configured for the connector.
- Parameters:
connector (dict) – Connector document containing an api_key field.
- Raises:
HTTPException – If the API key is missing or empty.
- Returns:
API key string to be used in x-api-key header.
- Return type:
str