add dotenv variable for rammerhead URL constructor

This commit is contained in:
wearrrrr 2024-02-11 20:14:37 -06:00
parent 4030166454
commit 5b08275dfe

View file

@ -14,6 +14,7 @@ dotenv.config();
if (!existsSync("./dist")) build(); if (!existsSync("./dist")) build();
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
const SITE_URL = process.env.URL || "http://0.0.0.0";
const bare = createBareServer("/bare/"); const bare = createBareServer("/bare/");
console.log(chalk.gray("Starting Bare...")); console.log(chalk.gray("Starting Bare..."));
@ -43,7 +44,7 @@ const rammerheadSession = /^\/[a-z0-9]{32}/;
const rh_path = "node_modules/rammerhead/src/client"; const rh_path = "node_modules/rammerhead/src/client";
function shouldRouteRh(req) { function shouldRouteRh(req) {
const url = new URL(req.url, "http://0.0.0.0"); const url = new URL(req.url, SITE_URL);
return rammerheadScopes.includes(url.pathname) || rammerheadSession.test(url.pathname); return rammerheadScopes.includes(url.pathname) || rammerheadSession.test(url.pathname);
} }