Backend: add PUBLIC_BASE_PATH for NIP-98 URL behind /api proxy

Made-with: Cursor
This commit is contained in:
Michaël
2026-02-28 00:21:01 -03:00
parent c1ee2d54f9
commit bdb4892014
2 changed files with 5 additions and 2 deletions

View File

@@ -24,6 +24,8 @@ function envBool(key: string, defaultValue: boolean): boolean {
export const config = {
port: envInt("PORT", 3001),
trustProxy: envBool("TRUST_PROXY", false),
/** Public path prefix when behind a reverse proxy that strips it (e.g. nginx /api/ -> backend /). */
publicBasePath: (process.env.PUBLIC_BASE_PATH ?? "").replace(/\/$/, ""),
allowedOrigins: (process.env.ALLOWED_ORIGINS ?? process.env.FRONTEND_URL ?? "http://localhost:5173,http://localhost:5174").split(",").map((s) => s.trim()),
// Database: omit DATABASE_URL for SQLite; set for Postgres