43 lines
1011 B
TypeScript
43 lines
1011 B
TypeScript
import 'dotenv/config'
|
|
|
|
const requiredEnvVars = [
|
|
'SCOUT_URL',
|
|
'S3_ACCESS_KEY_ID',
|
|
'S3_SECRET_ACCESS_KEY',
|
|
'S3_REGION',
|
|
'S3_ENDPOINT',
|
|
'S3_BUCKET',
|
|
'POSTGREST_URL',
|
|
'AUTOMATION_USER_JWT',
|
|
] 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 {
|
|
scoutUrl: string;
|
|
postgrestUrl: string;
|
|
automationUserJwt: string;
|
|
s3AccessKeyId: string;
|
|
s3SecretAccessKey: string;
|
|
s3Region: string;
|
|
s3Bucket: string;
|
|
s3Endpoint: string;
|
|
}
|
|
|
|
|
|
export const configs: Config = {
|
|
scoutUrl: getEnvVar('SCOUT_URL'),
|
|
postgrestUrl: getEnvVar('POSTGREST_URL'),
|
|
automationUserJwt: getEnvVar('AUTOMATION_USER_JWT'),
|
|
s3AccessKeyId: getEnvVar('S3_ACCESS_KEY_ID'),
|
|
s3SecretAccessKey: getEnvVar('S3_SECRET_ACCESS_KEY'),
|
|
s3Region: getEnvVar('S3_REGION'),
|
|
s3Bucket: getEnvVar('S3_BUCKET'),
|
|
s3Endpoint: getEnvVar('S3_ENDPOINT'),
|
|
} |