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

12 lines
301 B
TypeScript
Raw Normal View History

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