From 5c50638a4be1ed7aadefbd55f69765c5d4127b6a Mon Sep 17 00:00:00 2001 From: MotorTruck1221 Date: Sat, 21 Dec 2024 04:29:41 -0700 Subject: [PATCH] Allow the Domain to be set via an env var too --- server/server.ts | 2 +- server/standalone/standalone.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/server.ts b/server/server.ts index 23fb2b1aa..9f70f242a 100644 --- a/server/server.ts +++ b/server/server.ts @@ -28,7 +28,7 @@ if (parsedDoc.seo.enabled && !parsedDoc.seo.both || !parsedDoc.seo.enabled) { }); await app.register(fastifyStatic, { root: `${Deno.cwd()}/dist/seo`, - constraints: { host: new URL(parsedDoc.seo.domain).host }, + constraints: { host: new URL(Deno.env.get('DOMAIN') || parsedDoc.seo.domain).host }, decorateReply: false }) } diff --git a/server/standalone/standalone.ts b/server/standalone/standalone.ts index d8edbc484..931b9823d 100644 --- a/server/standalone/standalone.ts +++ b/server/standalone/standalone.ts @@ -15,7 +15,7 @@ if (parsedDoc.seo.enabled && !parsedDoc.seo.both || !parsedDoc.seo.enabled) { if (parsedDoc.seo.enabled && parsedDoc.seo.both) { app.use('/*', (ctx, next) => { - if (new URL(ctx.req.url).host === new URL(parsedDoc.seo.domain).host) { + if (new URL(ctx.req.url).host === new URL(Deno.env.get('DOMAIN') || parsedDoc.seo.domain).host) { return serveStatic({ root: `${Deno.cwd()}/dist/seo` })(ctx, next); } else {