mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-14 22:00:50 -05:00
validate environment variables at build time
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { env } from "../../lib/env";
|
||||
import Giscus from "@giscus/react";
|
||||
import * as config from "../../lib/config";
|
||||
import type { GiscusProps } from "@giscus/react";
|
||||
@@ -10,7 +11,7 @@ export type CommentsProps = {
|
||||
|
||||
const Comments = ({ title }: CommentsProps) => {
|
||||
// fail silently if giscus isn't configured
|
||||
if (!process.env.NEXT_PUBLIC_GISCUS_REPO_ID || !process.env.NEXT_PUBLIC_GISCUS_CATEGORY_ID) {
|
||||
if (!env.NEXT_PUBLIC_GISCUS_REPO_ID || !env.NEXT_PUBLIC_GISCUS_CATEGORY_ID) {
|
||||
console.warn(
|
||||
"[giscus] not configured, ensure 'NEXT_PUBLIC_GISCUS_REPO_ID' and 'NEXT_PUBLIC_GISCUS_CATEGORY_ID' environment variables are set."
|
||||
);
|
||||
@@ -21,10 +22,10 @@ const Comments = ({ title }: CommentsProps) => {
|
||||
return (
|
||||
<Giscus
|
||||
repo={config.githubRepo as GiscusProps["repo"]}
|
||||
repoId={process.env.NEXT_PUBLIC_GISCUS_REPO_ID}
|
||||
repoId={env.NEXT_PUBLIC_GISCUS_REPO_ID}
|
||||
term={title}
|
||||
category="Comments"
|
||||
categoryId={process.env.NEXT_PUBLIC_GISCUS_CATEGORY_ID}
|
||||
categoryId={env.NEXT_PUBLIC_GISCUS_CATEGORY_ID}
|
||||
mapping="specific"
|
||||
reactionsEnabled="1"
|
||||
emitMetadata="0"
|
||||
|
||||
@@ -2,6 +2,7 @@ import clsx from "clsx";
|
||||
import { HeartIcon } from "lucide-react";
|
||||
import Link from "../Link";
|
||||
import * as config from "../../lib/config";
|
||||
import { RELEASE_TIMESTAMP } from "../../lib/config/constants";
|
||||
import type { ComponentPropsWithoutRef } from "react";
|
||||
|
||||
import styles from "./Footer.module.css";
|
||||
@@ -21,7 +22,7 @@ const Footer = ({ className, ...rest }: FooterProps) => {
|
||||
<Link href="/previously" title="Previously on..." plain className={styles.link}>
|
||||
{config.copyrightYearStart}
|
||||
</Link>{" "}
|
||||
– {new Date(process.env.RELEASE_DATE || Date.now()).getUTCFullYear()}.
|
||||
– {new Date(RELEASE_TIMESTAMP).getUTCFullYear()}.
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user