import 'dotenv/config' const requiredEnvVars = [ 'HTTP_PROXY', 'WORKER_CONNECTION_STRING', 'POSTGREST_URL', 'DISCORD_TOKEN', 'DISCORD_CHANNEL_ID', 'DISCORD_GUILD_ID', 'DISCORD_APPLICATION_ID', '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 { postgrestUrl: string; httpProxy: string; token: string; automationUserJwt: string; discordGuildId: string; discordChannelId: string; connectionString: string; discordApplicationId: string; } export const configs: Config = { 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'), }