From 23ac75ce1dc1158bcd759595a2b5c9481f2477d2 Mon Sep 17 00:00:00 2001 From: mptyl Date: Sun, 16 Aug 2026 17:36:42 +0200 Subject: [PATCH] fix(auth): declare local development environment --- backend/test/config.test.ts | 8 +++++++- deploy/compose.local.yaml | 1 + docker-compose.dev.yml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/test/config.test.ts b/backend/test/config.test.ts index 086902bf..c0ae26da 100644 --- a/backend/test/config.test.ts +++ b/backend/test/config.test.ts @@ -1,5 +1,5 @@ import { expect, test } from "vitest"; -import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { stringify } from "yaml"; @@ -88,6 +88,12 @@ test("loadConfig allows none and mock only outside production when auth.yaml is .toThrow("production requires auth.yaml or AUTH_MODE=upstream"); }); +test("local Compose profiles explicitly select the development auth environment", () => { + for (const profile of ["../../deploy/compose.local.yaml", "../../docker-compose.dev.yml"]) { + expect(readFileSync(new URL(profile, import.meta.url), "utf8")).toMatch(/NODE_ENV:\s*development/); + } +}); + test("loadConfig makes an existing auth.yaml authoritative and rejects AUTH_MODE split-brain", () => { const { directory, file } = authFile(oidcAuthConfig()); try { diff --git a/deploy/compose.local.yaml b/deploy/compose.local.yaml index fcad3e94..833d6bae 100644 --- a/deploy/compose.local.yaml +++ b/deploy/compose.local.yaml @@ -2,6 +2,7 @@ services: core: environment: AUTH_MODE: none + NODE_ENV: development THT_WORKSPACE_INSTALLATION_ID: local ports: - "127.0.0.1:${THOTH_CORE_HTTP_PORT:-8787}:8787" diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index e869c91e..4cc28918 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -17,6 +17,7 @@ services: THT_BIN: /opt/venv/bin/tht PI_BIN: pi AUTH_MODE: none + NODE_ENV: development THT_SESSION_STORAGE: local THT_HOME: /data/local-home THT_DATA_ROOT: /data