mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
perf(serverless): fallback to static env
This commit is contained in:
parent
2462659026
commit
913a905100
@ -48,7 +48,7 @@ export default async function LocaleLayout({
|
||||
return (
|
||||
<html lang={locale} suppressHydrationWarning>
|
||||
<head>
|
||||
<PublicEnvScript />
|
||||
{!process.env.VERCEL && !process.env.CF_PAGES && <PublicEnvScript />}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css"
|
||||
|
@ -1,8 +1,12 @@
|
||||
import { env } from "next-runtime-env";
|
||||
|
||||
export default function getEnv(key: string) {
|
||||
if (process.env.VERCEL || process.env.CF_PAGES) {
|
||||
return process.env[key];
|
||||
} else {
|
||||
if (key.startsWith("NEXT_PUBLIC_")) {
|
||||
return env(key);
|
||||
}
|
||||
return process.env[key];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user