Skip to content

Commit

Permalink
Allow the Domain to be set via an env var too
Browse files Browse the repository at this point in the history
  • Loading branch information
MotorTruck1221 committed Dec 21, 2024
1 parent 5c3e698 commit 5c50638
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down
2 changes: 1 addition & 1 deletion server/standalone/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5c50638

Please sign in to comment.