mirror of
https://github.com/PreMiD/PreMiD.git
synced 2026-04-06 04:41:58 +02:00
fix(pd): use correct env variable
This commit is contained in:
1
apps/pd/environment.d.ts
vendored
1
apps/pd/environment.d.ts
vendored
@@ -8,5 +8,6 @@ declare namespace NodeJS {
|
||||
HOST?: string;
|
||||
RATELIMIT_MAX?: string;
|
||||
RATELIMIT_WINDOW?: string;
|
||||
BASE_URL?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createServer } from "./functions/createServer.js";
|
||||
import redis from "./redis.js";
|
||||
|
||||
if (!process.env.REDIS_SENTINELS) console.log("WARNING: No REDIS_SENTINELS environment variable set");
|
||||
if (process.env.NODE_ENV === "production" && !process.env.BASE_URL) throw new Error("BASE_URL environment variable is required in production");
|
||||
|
||||
export const server = await createServer(redis);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const handler: RouteHandlerMethod = async (request, reply) => {
|
||||
|
||||
if (existingUrl) {
|
||||
reply.header("Cache-control", `public, max-age=${30 * 60}`);
|
||||
return reply.send(process.env.HOST + existingUrl);
|
||||
return reply.send(process.env.BASE_URL + existingUrl);
|
||||
}
|
||||
|
||||
const uniqueId = `${nanoid(10)}.${type}`;
|
||||
|
||||
@@ -33,7 +33,7 @@ const handler: RouteHandlerMethod = async (request, reply) => {
|
||||
|
||||
if (existingUrl) {
|
||||
reply.header("Cache-control", `public, max-age=${30 * 60}`);
|
||||
return reply.send(process.env.HOST + existingUrl);
|
||||
return reply.send(process.env.BASE_URL + existingUrl);
|
||||
}
|
||||
|
||||
const uniqueId = `${nanoid(10)}.${type.ext}`;
|
||||
|
||||
Reference in New Issue
Block a user