-
Notifications
You must be signed in to change notification settings - Fork 20
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
[MISC] Move uri generation to update endpoints #584
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #584 +/- ##
==========================================
+ Coverage 70.84% 70.89% +0.04%
==========================================
Files 12 12
Lines 3025 3030 +5
Branches 536 536
==========================================
+ Hits 2143 2148 +5
Misses 768 768
Partials 114 114 ☔ View full report in Codecov by Sentry. |
# Set connection string URI. | ||
self.database_provides.set_uris( | ||
event.relation.id, | ||
f"postgresql://{user}:{password}@{self.charm.primary_endpoint}:{DATABASE_PORT}/{database}", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_on_database_requested
is ran only when the db is requested, so the uri won't be updated if there's a switchover.
for relation_id in rel_data.keys(): | ||
user = f"relation-{relation_id}" | ||
database = rel_data[relation_id].get("database") | ||
password = secret_data.get(relation_id, {}).get("password") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will refetch all the secrets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix! CC: @lucasgameiroborges
Move uri generation to
update_endpoints