Prepare local dev for tenant DB switching

- Add .env.local to .gitignore (gitignored local overrides for DB_HOST/DB_PORT)
- Load .env.local with override in node tests — create this file to point at
  local MariaDB (DB_HOST=localhost DB_PORT=30310) instead of VPS via WireGuard
- MariaDB NodePorts added to K8s manifests (infra/k8s/local/):
  mariadb dev: 30310, mariadb-test: 30311

Workflow: dump tenant DB → load into local mariadb pod → set .env.local → run node tests locally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nico 2026-04-03 22:19:41 +02:00
parent b35610cf6f
commit 5964ca55e1
2 changed files with 11 additions and 2 deletions

3
.gitignore vendored
View File

@ -2,4 +2,7 @@
__pycache__/
*.pyc
.env
.env.local
trace.jsonl
docker/mariadb/*.sql.gz
docker/mariadb/dump_*.sql

View File

@ -16,9 +16,15 @@ import os
import sys
from pathlib import Path
# Load .env so DB_HOST, OPENROUTER_API_KEY etc. are set
# Load .env then .env.local (override) so DB_HOST, OPENROUTER_API_KEY etc. are set.
# .env.local is gitignored — use it to point at a local tenant DB:
# DB_HOST=localhost
# DB_PORT=30310 (mariadb NodePort, dev namespace)
# DB_PORT=30311 (mariadb-test NodePort, test namespace)
from dotenv import load_dotenv
load_dotenv(Path(__file__).parent.parent / ".env")
_root = Path(__file__).parent.parent
load_dotenv(_root / ".env")
load_dotenv(_root / ".env.local", override=True)
sys.path.insert(0, str(Path(__file__).parent.parent))