Only use edge functions for index/grid on Pro

This commit is contained in:
Sam Becker 2023-09-22 20:58:02 -05:00
parent 2fc2fdf5ba
commit 6e54f877bd
3 changed files with 10 additions and 4 deletions

View File

@ -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<Metadata> {
const photos = await getPhotosCached({ limit: MAX_PHOTOS_TO_SHOW_HOME});

View File

@ -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<Metadata> {
const photos = await getPhotosCached();

View File

@ -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 =