From 5964ca55e1af54267c5a4ecee8d2a4ecedfe3967 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 3 Apr 2026 22:19:41 +0200 Subject: [PATCH] Prepare local dev for tenant DB switching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .gitignore | 3 +++ tests/test_node_eras.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f316d07..c8b10f2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ __pycache__/ *.pyc .env +.env.local trace.jsonl +docker/mariadb/*.sql.gz +docker/mariadb/dump_*.sql diff --git a/tests/test_node_eras.py b/tests/test_node_eras.py index cfccde4..74f473d 100644 --- a/tests/test_node_eras.py +++ b/tests/test_node_eras.py @@ -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))