Added an API to send google configs to frontend#746
Added an API to send google configs to frontend#746yugesh-ganipudi wants to merge 1 commit intojuspay:releasefrom
Conversation
WalkthroughA new public configuration endpoint is added to expose the Google Client ID. The change introduces a Pydantic response model and a GET ChangesPublic Config Endpoint
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a public Breeze Buddy API endpoint to expose frontend-consumable Google SSO configuration (currently the Google OAuth client ID) so clients can initialize Google Identity Services without hardcoding env-specific values.
Changes:
- Introduces
GET /configon the Breeze Buddy signup router to return agoogle_client_id. - Adds a small response model (
PublicConfigResponse) and wires it to the new endpoint.
| async def get_public_config() -> PublicConfigResponse: | ||
| return PublicConfigResponse(google_client_id=GOOGLE_CLIENT_ID) |
| class PublicConfigResponse(BaseModel): | ||
| google_client_id: str | ||
|
|
| @router.get( | ||
| "/config", | ||
| response_model=PublicConfigResponse, | ||
| summary="Public client configuration (Google Client ID, etc.)", |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/api/routers/breeze_buddy/signup/__init__.py`:
- Around line 129-130: get_public_config currently returns an empty
google_client_id when GOOGLE_CLIENT_ID is unset; update get_public_config to
check GOOGLE_CLIENT_ID and, if it's falsy/empty, raise an HTTP 503 (e.g., via
fastapi.HTTPException) with a clear message mirroring the behavior in
_verify_google_id_token in handlers.py so clients can detect the
misconfiguration early; otherwise return
PublicConfigResponse(google_client_id=GOOGLE_CLIENT_ID) as before.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ca8fba2e-ac62-4b8e-bba4-ea01b512c0f3
📒 Files selected for processing (1)
app/api/routers/breeze_buddy/signup/__init__.py
| async def get_public_config() -> PublicConfigResponse: | ||
| return PublicConfigResponse(google_client_id=GOOGLE_CLIENT_ID) |
There was a problem hiding this comment.
Return a 503 when GOOGLE_CLIENT_ID is unconfigured, consistent with handlers.py.
GOOGLE_CLIENT_ID defaults to "" when the env var is absent (see app/core/config/static.py:352). As written, this endpoint silently returns {"google_client_id": ""}, leaving the frontend to fail later with an opaque Google Sign-In error. _verify_google_id_token in handlers.py raises HTTP 503 in the exact same situation — the /config endpoint should mirror that behaviour so clients can detect and surface the misconfiguration early.
🛡️ Proposed fix
+from fastapi import APIRouter, Depends, HTTPException, status
...
async def get_public_config() -> PublicConfigResponse:
+ if not GOOGLE_CLIENT_ID:
+ raise HTTPException(
+ status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
+ detail="Google SSO is not configured on this server.",
+ )
return PublicConfigResponse(google_client_id=GOOGLE_CLIENT_ID)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/api/routers/breeze_buddy/signup/__init__.py` around lines 129 - 130,
get_public_config currently returns an empty google_client_id when
GOOGLE_CLIENT_ID is unset; update get_public_config to check GOOGLE_CLIENT_ID
and, if it's falsy/empty, raise an HTTP 503 (e.g., via fastapi.HTTPException)
with a clear message mirroring the behavior in _verify_google_id_token in
handlers.py so clients can detect the misconfiguration early; otherwise return
PublicConfigResponse(google_client_id=GOOGLE_CLIENT_ID) as before.
Added an API to send google configs to frontend
Summary by CodeRabbit
Release Notes