MUH. IQRAM BAHRING 9c37af90a9 test(harness): isolate DATA_DIR so tests never write to the real DB
Root cause of fake connections in Usage (zed-live-*@example.com,
guard-*@example.com, zed "Account N", kimchi-nope): route-level tests
(zed-live-models, zed-native-auth) call createProviderConnection, which
persists to $DATA_DIR/db/data.sqlite. With DATA_DIR unset — the default
for `npx vitest run` — that resolved to the user's real ~/.9router DB,
appending test rows on every run. Both files documented "RUN WITH AN
ISOLATED DB" but never enforced it.

Add tests/setup/isolateDataDir.js (wired via vitest setupFiles) that
points DATA_DIR at a throwaway temp dir before src/lib/dataDir.js is
imported. Opt out with RUN_REAL=1 or an explicit DATA_DIR (used by the
*.real.test.js suites that read live credentials).

Verified: a full suite run now leaves the real DB byte-count unchanged;
new guard test tests/unit/test-data-dir-isolation.test.js locks it in.
2026-09-19 12:37:57 +08:00
2026-09-18 18:31:12 +07:00
2026-01-05 09:58:59 +07:00
2026-03-09 16:30:39 +07:00

9Router MIBP Version

A local AI routing gateway with provider fallback and token-saving features. This is a fork of decolua/9router.

Installation

Option 1: Docker

Pull the image:

docker pull mhiqrambhrng/9router-mibp-version:latest

Run the container:

mkdir -p 9router-data
docker run -d \
  --name 9router \
  -p 20128:20128 \
  -v 9router-data:/app/data \
  -e DATA_DIR=/app/data \
  -e PORT=20128 \
  -e HOSTNAME=0.0.0.0 \
  -e NODE_ENV=production \
  -e JWT_SECRET=<generate-with-openssl-rand-hex-32> \
  -e INITIAL_PASSWORD=<your-dashboard-password> \
  -e API_KEY_SECRET=<generate-with-openssl-rand-hex-32> \
  -e MACHINE_ID_SALT=<generate-with-openssl-rand-hex-32> \
  mhiqrambhrng/9router-mibp-version:latest

Or using Docker Compose (a docker-compose.yml is included in this repo):

cp .env.example .env   # fill in JWT_SECRET, INITIAL_PASSWORD, API_KEY_SECRET, MACHINE_ID_SALT
docker compose up -d

Dashboard opens at http://localhost:20128/dashboard.

Option 2: Manual (from source)

Requirements: Node.js 22 or newer.

git clone https://github.com/mhiqrambg/9router-mibp-version.git
cd 9router-mibp-version

cp .env.example .env
# Edit .env: set JWT_SECRET, INITIAL_PASSWORD, API_KEY_SECRET, MACHINE_ID_SALT

npm install

# Development server
npm run dev

# Or production build
npm run build
npm run start

Dashboard opens at http://localhost:20128/dashboard.

More Information

S
Description
No description provided
Readme MIT
19 MiB
Languages
JavaScript 99.6%
CSS 0.3%