Release 202506041641

This commit is contained in:
pluja
2025-06-04 16:41:32 +00:00
parent 5812399e29
commit dacf73a804
24 changed files with 839 additions and 184 deletions

View File

@@ -0,0 +1,14 @@
import { loadEnv } from 'vite'
/** Only use when you can't import the variables from `astro:env/server` */
// @ts-expect-error process.env actually exists
const untypedServerEnvVariables = loadEnv(process.env.NODE_ENV, process.cwd(), '')
/** Only use when you can't import the variables from `astro:env/server` */
export function getServerEnvVariable<T extends keyof typeof untypedServerEnvVariables>(
name: T
): NonNullable<(typeof untypedServerEnvVariables)[T]> {
const value = untypedServerEnvVariables[name]
if (!value) throw new Error(`${name} environment variable is not set`)
return value
}