feat: add environment configuration and SQLite migration support
This commit is contained in:
@@ -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" }));
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user