From 5dafcc2118589ccb0ec924637cb93078c9ee159a Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Mon, 13 Apr 2026 14:58:44 -0700 Subject: [PATCH] =?UTF-8?q?fix(cleanup):=20TODO-006=20=E2=80=94=20centrali?= =?UTF-8?q?ze=20backend=20URL=20via=20getBackendBaseURL()=20from=20product?= =?UTF-8?q?-config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/lib/context-messages.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/web/src/lib/context-messages.ts b/web/src/lib/context-messages.ts index 647a46d..040c6a7 100644 --- a/web/src/lib/context-messages.ts +++ b/web/src/lib/context-messages.ts @@ -2,6 +2,8 @@ // Keyword → helpful prep message mapping. Expandable, no LLM needed. // Used in notification body and on timeline to give actionable context. +import { getBackendBaseURL } from './product-config'; + export interface ContextRule { keywords: string[]; messages: string[]; @@ -192,15 +194,8 @@ export async function fetchEnrichedMessage(params: { timeOfDay?: string; recentTimerLabels?: string[]; }): Promise { - // TODO-006: Centralize backend URL configuration - // Priority: low | Phase: A.4 - // Replace the raw env var with a centralized config helper. Options: - // 1. Create getBackendUrl() in web/src/lib/product-config.ts that reads - // NEXT_PUBLIC_CHRONOMIND_BACKEND_URL with a sensible default - // 2. Or use the same pattern as auth-api.ts getBaseUrl() but for the product backend - // This avoids scattering env var references across multiple files. try { - const backendUrl = process.env.NEXT_PUBLIC_CHRONOMIND_BACKEND_URL ?? 'http://localhost:4011'; + const backendUrl = getBackendBaseURL(); const res = await fetch(`${backendUrl}/api/context-message`, { method: 'POST', headers: { 'Content-Type': 'application/json' },