fp/packages/fetchers/src/config.ts

28 lines
561 B
TypeScript
Raw Normal View History

2024-09-06 05:39:08 +00:00
const requiredEnvVars = [
'POSTGREST_URL',
'AUTOMATION_USER_JWT',
'SCOUT_URL',
] as const;
const getEnvVar = (key: typeof requiredEnvVars[number]): string => {
const value = process.env[key];
if (!value) {
throw new Error(`Missing ${key} env var`);
}
return value;
};
export interface Config {
postgrestUrl: string;
automationUserJwt: string;
scoutUrl: string;
}
export const configs: Config = {
scoutUrl: getEnvVar('SCOUT_URL'),
postgrestUrl: getEnvVar('POSTGREST_URL'),
automationUserJwt: getEnvVar('AUTOMATION_USER_JWT')
}