mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-05-15 17:54:24 -04:00
validate environment variables at build time
This commit is contained in:
@@ -8,10 +8,6 @@ export const AVATAR_PATH = "app/avatar.jpg";
|
||||
// maximum width of content wrapper (e.g. for images) in pixels
|
||||
export const MAX_WIDTH = 865;
|
||||
|
||||
// same logic as metadataBase: https://nextjs.org/docs/app/api-reference/functions/generate-metadata#default-value
|
||||
export const BASE_URL =
|
||||
process.env.NEXT_PUBLIC_VERCEL_ENV === "production" && process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL
|
||||
? `https://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`
|
||||
: process.env.NEXT_PUBLIC_VERCEL_ENV === "preview" && process.env.NEXT_PUBLIC_VERCEL_URL
|
||||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
|
||||
: `http://localhost:${process.env.PORT || 3000}`;
|
||||
// defined in next.config.ts
|
||||
export const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL!;
|
||||
export const RELEASE_TIMESTAMP = process.env.NEXT_PUBLIC_RELEASE_TIMESTAMP!;
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as config from ".";
|
||||
import { BASE_URL } from "./constants";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
const metadata: Metadata = {
|
||||
const defaultMetadata: Metadata = {
|
||||
metadataBase: new URL(BASE_URL),
|
||||
title: {
|
||||
template: `%s – ${config.siteName}`,
|
||||
@@ -44,4 +44,4 @@ const metadata: Metadata = {
|
||||
},
|
||||
};
|
||||
|
||||
export default metadata;
|
||||
export default defaultMetadata;
|
||||
Reference in New Issue
Block a user