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

[MISC] Move uri generation to update endpoints #584

Merged
merged 1 commit into from
Aug 16, 2024
Merged

Conversation

dragomirp
Copy link
Contributor

@dragomirp dragomirp commented Aug 14, 2024

Move uri generation to update_endpoints

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.89%. Comparing base (a72977c) to head (03c6065).
Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

Comment on lines -118 to -122
# Set connection string URI.
self.database_provides.set_uris(
event.relation.id,
f"postgresql://{user}:{password}@{self.charm.primary_endpoint}:{DATABASE_PORT}/{database}",
)
Copy link
Contributor Author

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")
Copy link
Contributor Author

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.

@dragomirp dragomirp marked this pull request as ready for review August 14, 2024 19:07
Copy link
Contributor

@taurus-forever taurus-forever left a 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

@dragomirp dragomirp merged commit c5e7075 into main Aug 16, 2024
82 checks passed
@dragomirp dragomirp deleted the update-uri branch August 16, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants