webserver

This commit is contained in:
2026-02-01 17:13:39 +01:00
parent e2f69e68cd
commit c13ffc93c0
13 changed files with 1421 additions and 1 deletions

View File

@@ -6,6 +6,8 @@
interface BotConfig {
discord: {
token: string;
clientId: string;
clientSecret: string;
};
ai: {
openRouterApiKey: string;
@@ -24,6 +26,11 @@ interface BotConfig {
/** Chance of mentioning a random user (0-1) */
mentionProbability: number;
};
web: {
port: number;
baseUrl: string;
sessionSecret: string;
};
}
function getEnvOrThrow(key: string): string {
@@ -41,6 +48,8 @@ function getEnvOrDefault(key: string, defaultValue: string): string {
export const config: BotConfig = {
discord: {
token: getEnvOrThrow("DISCORD_TOKEN"),
clientId: getEnvOrThrow("DISCORD_CLIENT_ID"),
clientSecret: getEnvOrThrow("DISCORD_CLIENT_SECRET"),
},
ai: {
openRouterApiKey: getEnvOrThrow("OPENROUTER_API_KEY"),
@@ -61,4 +70,9 @@ export const config: BotConfig = {
mentionCooldown: 24 * 60 * 60 * 1000, // 24 hours
mentionProbability: 0.001,
},
web: {
port: parseInt(getEnvOrDefault("WEB_PORT", "3000")),
baseUrl: getEnvOrDefault("WEB_BASE_URL", "http://localhost:3000"),
sessionSecret: getEnvOrDefault("SESSION_SECRET", crypto.randomUUID()),
},
};