From e6751f6bee05a0e29305bac538544a7dbd67c984 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 7 Mar 2026 18:19:06 -0500 Subject: [PATCH] fix: survey invite links use FRONTEND_URL config instead of hardcoded URL PR environments were generating survey links pointing to production (resolutionflow.com) because the URL was hardcoded. Now uses the existing settings.FRONTEND_URL, falling back to localhost (debug) or production (release). Co-Authored-By: Claude Opus 4.6 --- backend/app/api/endpoints/admin_survey.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/app/api/endpoints/admin_survey.py b/backend/app/api/endpoints/admin_survey.py index f998b1e4..b6603a1b 100644 --- a/backend/app/api/endpoints/admin_survey.py +++ b/backend/app/api/endpoints/admin_survey.py @@ -29,11 +29,14 @@ logger = logging.getLogger(__name__) router = APIRouter(prefix="/admin", tags=["admin-survey"]) -FRONTEND_URL = "https://resolutionflow.com" +def _get_frontend_url() -> str: + if settings.FRONTEND_URL: + return settings.FRONTEND_URL + return "http://localhost:5173" if settings.DEBUG else "https://resolutionflow.com" def _build_invite_response(invite: SurveyInvite) -> SurveyInviteResponse: - base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173" + base_url = _get_frontend_url() return SurveyInviteResponse( id=str(invite.id), token=invite.token, @@ -63,7 +66,7 @@ async def create_survey_invite( if data.send_email and data.recipient_email: try: - base_url = FRONTEND_URL if not settings.DEBUG else "http://localhost:5173" + base_url = _get_frontend_url() survey_url = f"{base_url}/survey?t={invite.token}" sent = await EmailService.send_survey_invite_email( to_email=data.recipient_email,