2024-08-27 07:11:24 +00:00
|
|
|
import 'dotenv/config'
|
2024-08-07 23:43:17 +00:00
|
|
|
|
2024-08-27 07:11:24 +00:00
|
|
|
const requiredEnvVars = [
|
|
|
|
'HTTP_PROXY',
|
|
|
|
'WORKER_CONNECTION_STRING',
|
|
|
|
'POSTGREST_URL',
|
|
|
|
'DISCORD_TOKEN',
|
|
|
|
'DISCORD_CHANNEL_ID',
|
|
|
|
'DISCORD_GUILD_ID',
|
|
|
|
'DISCORD_APPLICATION_ID',
|
|
|
|
'AUTOMATION_USER_JWT',
|
2024-08-31 10:42:28 +00:00
|
|
|
'SCOUT_URL'
|
2024-08-27 07:11:24 +00:00
|
|
|
] as const;
|
2024-08-07 01:13:58 +00:00
|
|
|
|
2024-08-27 07:11:24 +00:00
|
|
|
const getEnvVar = (key: typeof requiredEnvVars[number]): string => {
|
|
|
|
const value = process.env[key];
|
|
|
|
if (!value) {
|
|
|
|
throw new Error(`Missing ${key} env var`);
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
};
|
2024-08-07 01:13:58 +00:00
|
|
|
|
|
|
|
export interface Config {
|
|
|
|
postgrestUrl: string;
|
2024-08-27 07:11:24 +00:00
|
|
|
httpProxy: string;
|
|
|
|
token: string;
|
2024-08-07 01:13:58 +00:00
|
|
|
automationUserJwt: string;
|
2024-08-07 23:43:17 +00:00
|
|
|
discordGuildId: string;
|
|
|
|
discordChannelId: string;
|
|
|
|
connectionString: string;
|
2024-08-17 02:42:44 +00:00
|
|
|
discordApplicationId: string;
|
2024-08-31 10:42:28 +00:00
|
|
|
scoutUrl: string;
|
2024-08-07 01:13:58 +00:00
|
|
|
}
|
2024-08-07 23:43:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
export const configs: Config = {
|
2024-08-31 10:42:28 +00:00
|
|
|
scoutUrl: getEnvVar('SCOUT_URL'),
|
2024-08-27 07:11:24 +00:00
|
|
|
connectionString: getEnvVar('WORKER_CONNECTION_STRING'),
|
|
|
|
httpProxy: getEnvVar('HTTP_PROXY'),
|
|
|
|
postgrestUrl: getEnvVar('POSTGREST_URL'),
|
|
|
|
token: getEnvVar('DISCORD_TOKEN'),
|
|
|
|
automationUserJwt: getEnvVar('AUTOMATION_USER_JWT'),
|
|
|
|
discordGuildId: getEnvVar('DISCORD_GUILD_ID'),
|
|
|
|
discordChannelId: getEnvVar('DISCORD_CHANNEL_ID'),
|
|
|
|
discordApplicationId: getEnvVar('DISCORD_APPLICATION_ID'),
|
|
|
|
}
|
|
|
|
|