Files
bot/packages/env/getRuntimeVariable.ts
2023-08-28 14:19:40 +02:00

11 lines
246 B
TypeScript

declare const window: {
__ENV?: any
}
const isBrowser = () => Boolean(typeof window !== 'undefined' && window.__ENV)
export const getRuntimeVariable = (key: string) => {
if (isBrowser()) return window.__ENV[key]
return process.env[key]
}