fix(cloudflare): get env

This commit is contained in:
hamster1963 2024-11-06 16:23:14 +08:00
parent d3936ff307
commit bc6566a363
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ export default async function LocaleLayout({
return ( return (
<html lang={locale} suppressHydrationWarning> <html lang={locale} suppressHydrationWarning>
<head> <head>
{!process.env.VERCEL && !process.env.CF_PAGES && <PublicEnvScript />} {!process.env.VERCEL && <PublicEnvScript />}
<link <link
rel="stylesheet" rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css" href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css"

View File

@ -1,7 +1,7 @@
import { env } from "next-runtime-env"; import { env } from "next-runtime-env";
export default function getEnv(key: string) { export default function getEnv(key: string) {
if (process.env.VERCEL || process.env.CF_PAGES) { if (process.env.VERCEL) {
return process.env[key]; return process.env[key];
} else { } else {
if (key.startsWith("NEXT_PUBLIC_")) { if (key.startsWith("NEXT_PUBLIC_")) {