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
Add base URL to configuration file #135
Conversation
Codecov Report
@@ Coverage Diff @@
## master #135 +/- ##
==========================================
+ Coverage 85.79% 85.98% +0.18%
==========================================
Files 39 39
Lines 1830 1826 -4
==========================================
Hits 1570 1570
+ Misses 260 256 -4
Continue to review full report at Codecov.
|
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.
thanks @CasperWA !
Besides the comments I have two more questions:
- I tried out your PR since I wanted to check what value the base URL takes if it is parsed from the request. This showed me that I actually don't know where this base URL is actually returned by the API. Can you give an example?
- I think the config.ini file should be at the top level of the repo. Since it is a configuration file, it should not be considered part of the code
optimade/server/routers/info.py
Outdated
base_url = ( | ||
CONFIG.base_url | ||
if CONFIG.base_url | ||
else f"{parse_result.scheme}://{parse_result.netloc}" |
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.
Oh, so you get the base URL from the request?
I wonder - would that solve the problem of having to specify the base URL?
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.
No.
The else
value is what used to be up to now, and is giving false information if run in a docker (it will provide you with something like http://localhost:3585
or whatever the port is).
Sure.
Yeah - it's not a bad idea to combine this PR with fixing #134. |
thanks, I tried setting it to 50 but I still see |
The default index_base_url for a provider is now `None` (or `null`).
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.
thanks @CasperWA !
Makes it possible to set the base URL from the config file. Should otherwise use the base URL gotten from parsing the requested URL (which may be "wrong" if run as a proxy).