19 lines
420 B
TypeScript
19 lines
420 B
TypeScript
import dotenv from "dotenv";
|
|
|
|
dotenv.config();
|
|
|
|
function required(name: string): string {
|
|
const value = process.env[name];
|
|
if (!value) {
|
|
throw new Error(`Missing required environment variable: ${name}`);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
export const env = {
|
|
token: required("DISCORD_TOKEN"),
|
|
clientId: required("DISCORD_CLIENT_ID"),
|
|
guildId: process.env.DISCORD_GUILD_ID,
|
|
databaseUrl: required("DATABASE_URL"),
|
|
};
|