Initial Commit with Working server and metrics
This commit is contained in:
30
dist/config.js
vendored
Normal file
30
dist/config.js
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Zentrale Konfiguration, per .env überschreibbar
|
||||
export default {
|
||||
port: parseInt(process.env.PORT || "8080", 10),
|
||||
// Upstream (Epirent)
|
||||
upstreamBase: process.env.UPSTREAM_BASE || "https://epirent.example.com", // <-- anpassen
|
||||
epiNoSession: process.env.EPI_NO_SESSION || "true",
|
||||
epiAccessToken: process.env.EPI_ACCESS_TOKEN || "xxxDerAccessTokenxxx",
|
||||
// Cache
|
||||
ttlSeconds: parseInt(process.env.TTL_SECONDS || "600", 10), // frisch
|
||||
staleSeconds: parseInt(process.env.STALE_SECONDS || "600", 10), // zusätzlich stale
|
||||
// Optional: Pfad-spezifische TTL-Regeln (Regex-Strings)
|
||||
routeTtls: (process.env.ROUTE_TTLS || "")
|
||||
.split("|")
|
||||
.map(s => s.trim())
|
||||
.filter(Boolean)
|
||||
.map(rule => {
|
||||
// Format: /regex/i=SECONDS (i optional)
|
||||
const [pat, sec] = rule.split("=");
|
||||
const flags = /\/[gimsuy]*$/.test(pat) ? pat.split("/").pop() : "";
|
||||
const body = pat.replace(/^\/|\/[gimsuy]*$/g, "");
|
||||
return { re: new RegExp(body, flags || "i"), seconds: parseInt(sec, 10) };
|
||||
}),
|
||||
// Redis (leer => In-Memory LRU)
|
||||
redisUrl: process.env.REDIS_URL || "",
|
||||
// Sicherheit / CORS
|
||||
allowCors: (process.env.CORS || "false").toLowerCase() === "true",
|
||||
corsOrigin: process.env.CORS_ORIGIN || "*",
|
||||
// Rate limit (sehr simpel, optional)
|
||||
rateLimitRps: parseInt(process.env.RATE_LIMIT_RPS || "0", 10), // 0 = aus
|
||||
};
|
||||
Reference in New Issue
Block a user