Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support providing postgres settings via argument #53

Merged
merged 7 commits into from
May 2, 2022

Conversation

alukach
Copy link
Contributor

@alukach alukach commented Apr 29, 2022

Currently, this codebase expects that the postgres configuration be available via environment variables. However, there are situations in which a user might not have these configurations available in the runtime environment. For example, a user might want their application to be responsive to DB credential changes without redeployment so they fetch credentials at Lambda startup from AWS Secrets Manager.

This PR reworks the connect_to_db() to take the PostgresSettings instance as an argument (ie Inversion of Control). This makes it easier for systems that depend on extending this codebase to customize how they generate settings.

/cc @anayeaye

titiler/pgstac/db.py Outdated Show resolved Hide resolved
@vincentsarago vincentsarago self-requested a review May 2, 2022 07:26
Copy link
Member

@vincentsarago vincentsarago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏 thanks @alukach

Would be great if you could add a line in the changelog 🙏

Just added on comment but if you feel it isn't necessary you can go ahead and merge.

CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@vincentsarago vincentsarago merged commit 1b570c2 into stac-utils:master May 2, 2022
@alukach alukach deleted the feature/customize-settings branch May 2, 2022 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants