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

Improve config loading warnings and prefer mongo_uri as source of database name #2183

Merged
merged 2 commits into from
Nov 17, 2024

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Nov 17, 2024

  • Only warn about a missing config file if the user actually tried to set a non-default config file (otherwise assume things are controlled by env vars)
  • Override the setting of the MongoDB database name in mongo_database with the fully qualified value in mongo_uri, when present.

@ml-evs ml-evs force-pushed the ml-evs/clarify-config-error-messages branch from 365120a to 09a93f6 Compare November 17, 2024 19:25
                    raise ValueError(
                        f"Invalid MongoDB URI: {self.mongo_uri}. It must start with "
                        "'mongodb://' or 'mongodb+srv://'."
                    )
@ml-evs ml-evs force-pushed the ml-evs/clarify-config-error-messages branch from 09a93f6 to 30d2973 Compare November 17, 2024 19:31
Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.67%. Comparing base (f34cff3) to head (30d2973).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
optimade/server/config.py 81.25% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2183   +/-   ##
=======================================
  Coverage   90.67%   90.67%           
=======================================
  Files          75       75           
  Lines        4845     4858   +13     
=======================================
+ Hits         4393     4405   +12     
- Misses        452      453    +1     
Flag Coverage Δ
project 90.67% <81.25%> (+<0.01%) ⬆️
validator 90.67% <81.25%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ml-evs ml-evs changed the title Config QoL updates Improve config loading warnings and prefer mongo_uri as source of database name Nov 17, 2024
@ml-evs ml-evs merged commit 03cd11c into main Nov 17, 2024
12 of 13 checks passed
@ml-evs ml-evs deleted the ml-evs/clarify-config-error-messages branch November 17, 2024 19:45
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.

1 participant