15 lines
312 B
TypeScript
15 lines
312 B
TypeScript
declare global {
|
|
interface Window {
|
|
__ENV__?: Record<string, string>;
|
|
}
|
|
}
|
|
|
|
export function getEnvConfig(): Record<string, string> {
|
|
if (typeof window === "undefined") return {};
|
|
return window.__ENV__ ?? {};
|
|
}
|
|
|
|
export function getEnv(key: string): string | undefined {
|
|
return getEnvConfig()[key];
|
|
}
|