fix(pd): use correct env variable

This commit is contained in:
Bas950
2024-03-24 14:11:44 +01:00
parent 6314acbf81
commit 85ec19bda3
4 changed files with 4 additions and 2 deletions

View File

@@ -8,5 +8,6 @@ declare namespace NodeJS {
HOST?: string;
RATELIMIT_MAX?: string;
RATELIMIT_WINDOW?: string;
BASE_URL?: string;
}
}

View File

@@ -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);

View File

@@ -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}`;

View File

@@ -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}`;