From 9000110d25d4d9c30ce35d0a2b7dcf4e928d23f3 Mon Sep 17 00:00:00 2001 From: debu-2 Date: Fri, 2 Oct 2026 11:58:57 +0530 Subject: [PATCH] config changes --- .env.example | 21 +++++++++++++-------- backend/.env.example | 6 +++++- docker-compose.yml | 7 ++++--- frontend/.env.example | 1 + frontend/vite.config.ts | 5 +++++ 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index f5f81fe..23d1fb5 100644 --- a/.env.example +++ b/.env.example @@ -2,20 +2,25 @@ # cp .env.example .env # # Compose uses this file for ${VAR} substitution and passes selected values -# into the backend container. See docs/ENVIRONMENT.md for the full flow. +# into the backend/frontend containers. See docs/ENVIRONMENT.md for the full flow. -# --- Backend auth (passed into urmi-backend) --- +# --- Local development (default) --- AUTH_SECRET=replace-with-at-least-32-random-characters AUTH_COOKIE_SECURE=false - -# Google OAuth — optional until you enable "Continue with Google" +ENVIRONMENT=development +FRONTEND_ORIGIN=http://localhost:5173 +VITE_API_URL=http://localhost:8000 GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= GOOGLE_REDIRECT_URI=http://localhost:8000/api/v1/auth/google/callback -# --- Optional overrides (uncomment if needed) --- -# FRONTEND_ORIGIN=http://localhost:5173 -# DATABASE_URL=postgresql+psycopg://urmi:urmi@postgres:5432/urmi +# --- Production example (urmiai.com + api.urmiai.com behind Caddy) --- +# AUTH_COOKIE_SECURE=true +# ENVIRONMENT=production +# FRONTEND_ORIGIN=https://urmiai.com +# VITE_API_URL=https://api.urmiai.com +# GOOGLE_REDIRECT_URI=https://api.urmiai.com/api/v1/auth/google/callback +# VOICE_RELAY_PUBLIC_URL=wss://api.urmiai.com/api/v1/voice # Ultronsms gateway credentials (backend only) ULTRONSMS_BASE_URL=https://ultronsms.com @@ -27,5 +32,5 @@ REDIS_URL=redis://redis:6379/0 BONVOICE_TOKEN=replace-with-bonvoice-token BONVOICE_API_URL=https://backend.pbx.bonvoice.com/autoDialManagement/autoCallBridging/ BONVOICE_MEDIA_ALLOWLIST=103.131.25.5 -# Public WSS base for Bonvoice templates (use wss:// in production, e.g. ngrok or your domain) +# Public WSS base; Bonvoice media endpoint = {VOICE_RELAY_PUBLIC_URL}/ws/media VOICE_RELAY_PUBLIC_URL=ws://localhost:8000/api/v1/voice diff --git a/backend/.env.example b/backend/.env.example index 1766d19..021d928 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -10,8 +10,9 @@ ENVIRONMENT=development # Local Postgres (host port 5433 when using docker compose postgres) DATABASE_URL=postgresql+psycopg://urmi:urmi@localhost:5433/urmi -# Must match the browser origin serving the frontend +# Must match the browser origin serving the frontend (CORS + OAuth redirect target) FRONTEND_ORIGIN=http://localhost:5173 +# Production: FRONTEND_ORIGIN=https://urmiai.com # --- Auth / sessions --- # Required in production. Use at least 32 random characters. @@ -27,6 +28,7 @@ ACCESS_TOKEN_MINUTES=10080 GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= GOOGLE_REDIRECT_URI=http://localhost:8000/api/v1/auth/google/callback +# Production: GOOGLE_REDIRECT_URI=https://api.urmiai.com/api/v1/auth/google/callback # Admin portal (/admin) ADMIN_USERNAME=root @@ -43,3 +45,5 @@ BONVOICE_TOKEN=replace-with-bonvoice-token BONVOICE_API_URL=https://backend.pbx.bonvoice.com/autoDialManagement/autoCallBridging/ BONVOICE_MEDIA_ALLOWLIST=103.131.25.5 VOICE_RELAY_PUBLIC_URL=ws://localhost:8000/api/v1/voice +# Production: VOICE_RELAY_PUBLIC_URL=wss://api.urmiai.com/api/v1/voice +# Bonvoice portal voicebot endpoint: wss://api.urmiai.com/api/v1/voice/ws/media diff --git a/docker-compose.yml b/docker-compose.yml index 5eacec3..eb7fc93 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: ports: - "5173:5173" environment: - VITE_API_URL: http://localhost:8000 + VITE_API_URL: ${VITE_API_URL:-http://localhost:8000} volumes: - ./frontend/src:/app/src - ./frontend/public:/app/public @@ -25,8 +25,9 @@ services: required: false environment: DATABASE_URL: postgresql+psycopg://urmi:urmi@postgres:5432/urmi - REDIS_URL: redis://redis:6379/0 - FRONTEND_ORIGIN: http://localhost:5173 + REDIS_URL: ${REDIS_URL:-redis://redis:6379/0} + ENVIRONMENT: ${ENVIRONMENT:-development} + FRONTEND_ORIGIN: ${FRONTEND_ORIGIN:-http://localhost:5173} AUTH_SECRET: ${AUTH_SECRET:-urmi-local-development-secret-change-me} AUTH_COOKIE_SECURE: ${AUTH_COOKIE_SECURE:-false} GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-} diff --git a/frontend/.env.example b/frontend/.env.example index 3e5f4ef..28ee441 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -5,3 +5,4 @@ # Backend API base URL (no trailing slash) VITE_API_URL=http://localhost:8000 +# Production: VITE_API_URL=https://api.urmiai.com diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 8b0f57b..493d102 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + host: true, + // Required when Caddy (or another proxy) forwards urmiai.com to the dev server + allowedHosts: ['urmiai.com', 'www.urmiai.com', 'localhost'], + }, })