-
Notifications
You must be signed in to change notification settings - Fork 28
🐛 Generate API base URL by active product ⚠️ #7619
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
🐛 Generate API base URL by active product ⚠️ #7619
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #7619 +/- ##
==========================================
- Coverage 87.66% 87.61% -0.06%
==========================================
Files 1794 1806 +12
Lines 69341 69686 +345
Branches 1136 1190 +54
==========================================
+ Hits 60790 61054 +264
- Misses 8241 8307 +66
- Partials 310 325 +15
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This pull request fixes the API base URL generation by replacing hardcoded values with dynamically constructed URLs based on the request's forwarded host information. It also centralizes host extraction logic via a new generator function and adds tests to verify the correct URL format.
- Updates API key creation flow to generate the correct base URL.
- Introduces the iter_originating_hosts helper for consistent host extraction.
- Adds unit tests to validate the new API base URL behavior.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
services/web/server/tests/unit/with_dbs/01/test_api_keys.py | Updated test to verify new API base URL generation with the forwarded host header. |
services/web/server/src/simcore_service_webserver/utils_aiohttp.py | Added the iter_originating_hosts generator to streamline host extraction. |
services/web/server/src/simcore_service_webserver/utils.py | Introduced is_ip_address to assist in host validation. |
services/web/server/src/simcore_service_webserver/products/_web_middlewares.py | Replaced manual host lookup with iter_originating_hosts for consistency. |
services/web/server/src/simcore_service_webserver/api_keys/_controller/rest.py | Updated _get_api_base_url to build the API URL dynamically and removed the hardcoded 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.
nice! thx
services/web/server/src/simcore_service_webserver/api_keys/_controller/rest.py
Outdated
Show resolved
Hide resolved
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.
very nice, thanks!
...simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py
Outdated
Show resolved
Hide resolved
services/director-v2/src/simcore_service_director_v2/modules/osparc_variables/substitutions.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/utils_aiohttp.py
Outdated
Show resolved
Hide resolved
@Mergifyio: Queue |
|
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.
fyi: only checked ops-related things (env vars etc), thanks a lot!
Sure, that's enough! |
What do these changes do?
This pull request fixes the API base URL generation by replacing hardcoded values with dynamically constructed URLs based on the request's forwarded host information. It also centralizes host extraction logic via a new generator function and adds tests to verify the correct URL format.
iter_origins
helper for consistent host extraction.Related issue/s
How to test
Dev-ops
Remove DIRECTOR_V2_PUBLIC_API_BASE_URL env vars