diff --git a/docker/.env.example b/docker/.env.example index a975ed8e7..95de0cf85 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -71,6 +71,7 @@ EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 # BACKEND_URL=https://api.yourdomain.com # NEXT_PUBLIC_FASTAPI_BACKEND_URL=https://api.yourdomain.com # NEXT_PUBLIC_ZERO_CACHE_URL=https://zero.yourdomain.com +# FASTAPI_BACKEND_INTERNAL_URL=http://backend:8000 # ------------------------------------------------------------------------------ # Zero-cache (real-time sync) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 549190947..93d725979 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -198,6 +198,7 @@ services: NEXT_PUBLIC_FASTAPI_BACKEND_AUTH_TYPE: ${AUTH_TYPE:-LOCAL} NEXT_PUBLIC_ETL_SERVICE: ${ETL_SERVICE:-DOCLING} NEXT_PUBLIC_DEPLOYMENT_MODE: ${DEPLOYMENT_MODE:-self-hosted} + FASTAPI_BACKEND_INTERNAL_URL: ${FASTAPI_BACKEND_INTERNAL_URL:-http://backend:8000} labels: - "com.centurylinklabs.watchtower.enable=true" depends_on: diff --git a/surfsense_obsidian/src/settings.ts b/surfsense_obsidian/src/settings.ts index ffa590cce..1191e5b7a 100644 --- a/surfsense_obsidian/src/settings.ts +++ b/surfsense_obsidian/src/settings.ts @@ -41,7 +41,13 @@ export class SurfSenseSettingTab extends PluginSettingTab { .setPlaceholder("https://surfsense.com") .setValue(settings.serverUrl) .onChange(async (value) => { - this.plugin.settings.serverUrl = value.trim(); + const next = value.trim(); + const previous = this.plugin.settings.serverUrl; + if (previous !== "" && next !== previous) { + this.plugin.settings.searchSpaceId = null; + this.plugin.settings.connectorId = null; + } + this.plugin.settings.serverUrl = next; await this.plugin.saveSettings(); }), ); @@ -59,7 +65,13 @@ export class SurfSenseSettingTab extends PluginSettingTab { .setPlaceholder("Paste token") .setValue(settings.apiToken) .onChange(async (value) => { - this.plugin.settings.apiToken = value.trim(); + const next = value.trim(); + const previous = this.plugin.settings.apiToken; + if (previous !== "" && next !== previous) { + this.plugin.settings.searchSpaceId = null; + this.plugin.settings.connectorId = null; + } + this.plugin.settings.apiToken = next; await this.plugin.saveSettings(); }); }) diff --git a/surfsense_web/app/api/zero/query/route.ts b/surfsense_web/app/api/zero/query/route.ts index 3d8ff0d33..a91edcd6f 100644 --- a/surfsense_web/app/api/zero/query/route.ts +++ b/surfsense_web/app/api/zero/query/route.ts @@ -5,7 +5,10 @@ import type { Context } from "@/types/zero"; import { queries } from "@/zero/queries"; import { schema } from "@/zero/schema"; -const backendURL = process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || "http://localhost:8000"; +const backendURL = + process.env.FASTAPI_BACKEND_INTERNAL_URL || + process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || + "http://localhost:8000"; async function authenticateRequest( request: Request