2
0
Files
bot/packages/env/getRuntimeVariable.ts

11 lines
325 B
TypeScript
Raw Normal View History

declare const window: {
__ENV?: any
}
export const getRuntimeVariable = (key: string, defaultValue?: string) => {
if (typeof window !== 'undefined')
return window.__ENV ? window.__ENV[key] ?? defaultValue : undefined
2023-08-29 14:33:41 +02:00
if (typeof process === 'undefined') return undefined
return process.env[key] ?? defaultValue
}