Repository Public MIT
1/** Runtime configuration. Read lazily so tests and CLIs can set process.env first. */2function req(name: string): string {3 const v = process.env[name];4 if (!v) throw new Error(`${name} is not set (see .env.example)`);5 return v;6}78export const env = {9 get databaseUrl() {10 return req("DATABASE_URL");11 },12 get tokenPepper() {13 const v = req("TOKEN_PEPPER");14 if (v.length < 32) throw new Error("TOKEN_PEPPER must be at least 32 characters of random data");15 return v;16 },17 get dataDir() {18 return req("DATA_DIR");19 },20 get publicUrl() {21 return (process.env.PUBLIC_URL ?? "http://localhost:8570").replace(/\/+$/, "");22 },23 get isProd() {24 return process.env.NODE_ENV === "production";25 },26 /** Loopback base used by the in-process MCP endpoint to call the REST API. */27 get internalUrl() {28 return `http://127.0.0.1:${process.env.PORT ?? "8570"}`;29 },30};31