Skip to content

Add config massaging step during configuration loading #3028

@max-moser

Description

@max-moser

Context

It can be cumbersome to configure finished (DB, cache, ...) connection strings, and it would be preferable to provide the various parts that make up the connection strings and have Invenio piece together the full versions from that.
This would make it easier to swap out individual parts for different environments (e.g. host name for local vs. containerized).

Proposed solution: Dedicated config massaging step

We could add another step during the config loading that calls entrypoint-based hooks.
Other packages (like Invenio-DB, Invenio-Cache, Invenio-Celery, ...) could use that hook to register logic for piecing together full connection strings from various pieces.
If not enough parts are set, that logic would be skipped.

Considered alternatives

Ordering of extension loading

At TU Wien, we're currently enforcing that Flask extensions are loaded in lexicographic order of their entrypoints and made sure that Invenio-Config-TUW is loaded first.
This effectively allows us to hook into the procedure after all config has been loaded but before any other extensions (which may cache connection strings, etc.) are loaded.
However, this mechanism would be pretty fragile and it would be a very opaque mechanism for use across several packages.
We do not want to do this.


Note: This issue might actually be better kept in Invenio-Config, but for consistency with the others I've put it here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleNo activity for more than 60 days.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions