Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚥 allow CONTENT_CDN host to be spec'ed #346

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/serious-beds-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@myst-theme/article': patch
'@myst-theme/book': patch
---

Theme now looks to CONTENT_CDN_HOST for static url re-writing
6 changes: 5 additions & 1 deletion themes/article/app/utils/loaders.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import {
} from '@myst-theme/common';
import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site';

const CONTENT_CDN_HOST =
process.env.CONTENT_CDN_HOST && process.env.CONTENT_CDN_HOST.startsWith('http')
? new URL(process.env.CONTENT_CDN_HOST).hostname
: process.env.CONTENT_CDN_HOST ?? 'localhost';
const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100';
const CONTENT_CDN = `http://localhost:${CONTENT_CDN_PORT}`;
const CONTENT_CDN = `http://${CONTENT_CDN_HOST}:${CONTENT_CDN_PORT}`;

export async function getConfig(): Promise<SiteManifest> {
const url = `${CONTENT_CDN}/config.json`;
Expand Down
6 changes: 5 additions & 1 deletion themes/book/app/utils/loaders.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import {
import { redirect } from '@remix-run/node';
import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site';

const CONTENT_CDN_HOST =
process.env.CONTENT_CDN_HOST && process.env.CONTENT_CDN_HOST.startsWith('http')
? new URL(process.env.CONTENT_CDN_HOST).hostname
: process.env.CONTENT_CDN_HOST ?? 'localhost';
const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100';
const CONTENT_CDN = `http://localhost:${CONTENT_CDN_PORT}`;
const CONTENT_CDN = `http://${CONTENT_CDN_HOST}:${CONTENT_CDN_PORT}`;

export async function getConfig(): Promise<SiteManifest> {
const url = `${CONTENT_CDN}/config.json`;
Expand Down
Loading