mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-06-08 23:16:48 +00:00
feat: initial webapp structure from notion2site
This commit is contained in:
17
lib/get-env.ts
Normal file
17
lib/get-env.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export function getEnv(
|
||||
key: string,
|
||||
defaultValue?: string,
|
||||
env = process.env
|
||||
): string {
|
||||
const value = env[key]
|
||||
|
||||
if (value !== undefined) {
|
||||
return value
|
||||
}
|
||||
|
||||
if (defaultValue !== undefined) {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
throw new Error(`Config error: missing required env var "${key}"`)
|
||||
}
|
||||
Reference in New Issue
Block a user