feat: add environment configuration and SQLite migration support

This commit is contained in:
Zoe
2026-09-19 15:00:32 -05:00
parent 75b3a01aee
commit 118a5387cb
10 changed files with 193 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { readConfig } from "../src/config.js";
test("configuration requires model settings and normalizes origin", () => {
assert.throws(() => readConfig({}), /Set LLAMA_CPP/);
const config = readConfig({ LLAMA_CPP_ORIGIN: "http://berlin:9931/", LLAMA_CPP_MODEL_ID: "model" });
assert.equal(config.llamaCppOrigin, "http://berlin:9931");
assert.equal(config.databasePath, "./data/token.sqlite");
for (const origin of ["http://berlin/v1", "ftp://berlin", "http://user:pass@berlin", "http://berlin?x=1"]) {
assert.throws(() => readConfig({ LLAMA_CPP_ORIGIN: origin, LLAMA_CPP_MODEL_ID: "model" }));
}
});