- /bug (alle Member): erstellt Gitea-Issue inkl. Screenshot-Upload als Asset; bug_reports-Tabelle für den Rückkanal — Issue geschlossen (issues-Webhook) → DM an den Reporter - Auto-Thread '💬 Devlog <Datum>' unter jedem Devlog-Post (Setting, Default an) - Watchdog: prüft Setting watchdog_urls alle 2 min, DM an Admin nach 2 Fails in Folge + Entwarnung mit Downtime-Dauer - Setup-Seite: Bug-Repo, Threads-Toggle, Watchdog-URLs; Env GITEA_API_TOKEN/GITEA_URL Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
2.4 KiB
JavaScript
55 lines
2.4 KiB
JavaScript
// Zentrale Konfiguration — liest alle Werte aus der Umgebung (.env lokal, env_file im Container)
|
|
import 'dotenv/config';
|
|
|
|
/** Pflicht-Variable lesen, bei Fehlen sofort mit klarer Meldung abbrechen */
|
|
function required(name) {
|
|
const value = process.env[name];
|
|
if (!value) {
|
|
console.error(`[config] Fehlende Umgebungsvariable: ${name} — siehe .env.example`);
|
|
process.exit(1);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
export const config = {
|
|
// Discord Bot
|
|
discordToken: required('DISCORD_TOKEN'),
|
|
discordClientId: required('DISCORD_CLIENT_ID'),
|
|
// Optional: Guild-ID für sofortige Slash-Command-Registrierung (global dauert bis zu 1h)
|
|
discordGuildId: process.env.DISCORD_GUILD_ID || null,
|
|
|
|
// Devlog-Archiv (Feature 3)
|
|
// Kanal-Defaults — können über die Settings-Seite im Webinterface
|
|
// überschrieben werden (DB gewinnt, Env ist Fallback)
|
|
devlogChannelId: process.env.DEVLOG_CHANNEL_ID || null,
|
|
// Secret im Pfad des Devlog-Endpoints: /webhooks/devlog/<secret>
|
|
// (steckt in der URL in tools/.devlog_webhook im EcoGame-Repo)
|
|
devlogPostSecret: required('DEVLOG_POST_SECRET'),
|
|
|
|
// Commit-Feed (Feature 2)
|
|
// Kanal, in den Push-Embeds gepostet werden (Default, siehe oben)
|
|
commitChannelId: process.env.COMMIT_CHANNEL_ID || null,
|
|
// Shared Secret — muss identisch im Gitea-Webhook eingetragen sein
|
|
giteaWebhookSecret: required('GITEA_WEBHOOK_SECRET'),
|
|
|
|
// HTTP-Server (Webhooks + Webinterface)
|
|
httpPort: Number(process.env.HTTP_PORT) || 3080,
|
|
|
|
// Webinterface (Feature 4)
|
|
// OAuth2 Client Secret: Developer Portal → OAuth2 → Client Secret
|
|
discordClientSecret: required('DISCORD_CLIENT_SECRET'),
|
|
// Zufälliger String (>=32 Zeichen) zum Signieren der Session-Cookies
|
|
sessionSecret: required('SESSION_SECRET'),
|
|
// Deine Discord-User-ID — nur dieser Account sieht die Commit-Seite
|
|
adminDiscordId: required('ADMIN_DISCORD_ID'),
|
|
// Öffentliche Basis-URL (für den OAuth2-Redirect); lokal: http://localhost:3080
|
|
publicUrl: (process.env.PUBLIC_URL || 'https://bot.d4rkst3r.de').replace(/\/$/, ''),
|
|
|
|
// SQLite-Datei (im Container: /app/data → ecobot_data-Volume)
|
|
dbPath: process.env.DB_PATH || './data/ecobot.db',
|
|
|
|
// Gitea-API (für /bug → Issues). Ohne Token ist /bug deaktiviert.
|
|
giteaUrl: (process.env.GITEA_URL || 'https://git.d4rkst3r.de').replace(/\/$/, ''),
|
|
giteaApiToken: process.env.GITEA_API_TOKEN || null,
|
|
};
|