diff --git a/src/app/(static)/grid/page.tsx b/src/app/(static)/grid/page.tsx index 241cf5a6..55cd675d 100644 --- a/src/app/(static)/grid/page.tsx +++ b/src/app/(static)/grid/page.tsx @@ -10,10 +10,11 @@ import { generateOgImageMetaForPhotos, getPhotosLimitForQuery } from '@/photo'; import PhotoGrid from '@/photo/PhotoGrid'; import PhotosEmptyState from '@/photo/PhotosEmptyState'; import { MAX_PHOTOS_TO_SHOW_HOME } from '@/photo/image-response'; +import { IS_PRO_MODE } from '@/site/config'; import PhotoTag from '@/tag/PhotoTag'; import { Metadata } from 'next'; -export const runtime = 'edge'; +export const runtime = IS_PRO_MODE ? 'edge' : 'nodejs'; export async function generateMetadata(): Promise { const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_HOME}); diff --git a/src/app/(static)/page.tsx b/src/app/(static)/page.tsx index 2fcb8570..2c2ea68c 100644 --- a/src/app/(static)/page.tsx +++ b/src/app/(static)/page.tsx @@ -5,9 +5,10 @@ import SiteGrid from '@/components/SiteGrid'; import { generateOgImageMetaForPhotos, getPhotosLimitForQuery } from '@/photo'; import PhotoLarge from '@/photo/PhotoLarge'; import PhotosEmptyState from '@/photo/PhotosEmptyState'; +import { IS_PRO_MODE } from '@/site/config'; import { Metadata } from 'next'; -export const runtime = 'edge'; +export const runtime = IS_PRO_MODE ? 'edge' : 'nodejs'; export async function generateMetadata(): Promise { const photos = await getPhotosCached(); diff --git a/src/site/config.ts b/src/site/config.ts index cd5ed052..974f8c3b 100644 --- a/src/site/config.ts +++ b/src/site/config.ts @@ -1,5 +1,6 @@ -export const SITE_TITLE = process.env.NEXT_PUBLIC_SITE_TITLE - || 'Photo Blog'; +export const SITE_TITLE = + process.env.NEXT_PUBLIC_SITE_TITLE || + 'Photo Blog'; const VERCEL_BRANCH_URL = process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL; const VERCEL_BRANCH = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF; @@ -19,6 +20,7 @@ export const BASE_URL = process.env.NODE_ENV === 'production' : 'http://localhost:3000'; export const SHOW_REPO_LINK = process.env.NEXT_PUBLIC_HIDE_REPO_LINK !== '1'; +export const IS_PRO_MODE = process.env.NEXT_PUBLIC_PRO_MODE === '1'; export const CONFIG_CHECKLIST_STATUS = { hasTitle: (process.env.NEXT_PUBLIC_SITE_TITLE ?? '').length > 0, @@ -30,6 +32,8 @@ export const CONFIG_CHECKLIST_STATUS = { (process.env.ADMIN_EMAIL ?? '').length > 0 && (process.env.ADMIN_PASSWORD ?? '').length > 0 ), + showRepoLink: SHOW_REPO_LINK, + isProMode: IS_PRO_MODE, }; export const IS_CHECKLIST_COMPLETE =