chore: load convex env from .env.local and support CONVEX_URL fallback

This commit is contained in:
Codex
2026-02-18 14:36:32 +00:00
parent 77f7f10921
commit 0ed3d2b4fe
4 changed files with 21 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ test("config uses defaults when env is missing", () => {
BETTER_AUTH_SECRET: "",
BETTER_AUTH_BASE_PATH: "",
INTERNAL_API_TOKEN: "",
CONVEX_URL: "",
QWEN_TTS_MODEL: "",
MINIO_SIGNED_URL_TTL_SEC: "",
MINIO_USE_SSL: "",
@@ -68,6 +69,7 @@ test("config reads convex/qwen/minio overrides", () => {
BETTER_AUTH_DEV_PASSWORD: "xartaudio-dev-password",
INTERNAL_API_TOKEN: "internal-token",
CONVEX_DEPLOYMENT_URL: "https://example.convex.cloud",
CONVEX_URL: "https://should-not-win.convex.cloud",
CONVEX_AUTH_TOKEN: "convex-token",
CONVEX_STATE_QUERY: "state:get",
CONVEX_STATE_MUTATION: "state:put",
@@ -104,3 +106,13 @@ test("config reads convex/qwen/minio overrides", () => {
assert.deepEqual(config.abuse.denyUserIds, ["u1", "u2"]);
});
});
test("config falls back to CONVEX_URL when deployment url variable is absent", () => {
withTempEnv({
CONVEX_DEPLOYMENT_URL: "",
CONVEX_URL: "https://from-convex-url.convex.cloud",
}, () => {
const { config } = require("../src/config");
assert.equal(config.convexDeploymentUrl, "https://from-convex-url.convex.cloud");
});
});