diff --git a/docs/guides/discord-bot-admin-panel.md b/docs/guides/discord-bot-admin-panel.md index f134f75..91b37f2 100644 --- a/docs/guides/discord-bot-admin-panel.md +++ b/docs/guides/discord-bot-admin-panel.md @@ -350,43 +350,79 @@ npm install express express-session passport passport-discord write-file-atomic ### Step 2: Create Environment Variables File -Create `.env` file with all secrets: +**Option A: Use the template (recommended)** + +Create `.env.template` first for reference: + +```bash +nano /opt/firefrost-discord-bot/.env.template +``` + +**Paste this complete template:** + +```env +# ========================================== +# FIREFROST COMMAND CENTER - ENVIRONMENT VARIABLES +# Copy this file to .env and fill in the values. +# DO NOT commit the actual .env file to version control. +# ========================================== + +# 1. Server Configuration +# ------------------------------------------ +# production or development +NODE_ENV=production +# The internal port the Node app runs on (Nginx proxies to this) +PORT=3100 +# A long, random string used to encrypt web session cookies +SESSION_SECRET=YOUR_SUPER_SECRET_RANDOM_STRING_HERE + +# 2. Discord Bot Core +# ------------------------------------------ +# The actual token for the Firefrost Discord Bot (from Discord Developer Portal -> Bot) +DISCORD_TOKEN=YOUR_BOT_TOKEN_HERE +# The ID of the Firefrost Gaming Discord Server +GUILD_ID=YOUR_SERVER_GUILD_ID_HERE + +# 3. Discord OAuth2 (Web Login) +# ------------------------------------------ +# From Discord Developer Portal -> OAuth2 -> General +DISCORD_CLIENT_ID=YOUR_OAUTH_CLIENT_ID_HERE +DISCORD_CLIENT_SECRET=YOUR_OAUTH_CLIENT_SECRET_HERE +# The URL Discord will redirect to after login (Must match the one added in the Dev Portal exactly) +CALLBACK_URL=https://discord-bot.firefrostgaming.com/auth/discord/callback + +# 4. Security & Auditing +# ------------------------------------------ +# Comma-separated list of Discord User IDs who are allowed to log in (Holly and Michael) +# Example: 123456789,987654321 +ALLOWED_ADMINS=HOLLYS_ID,MICHAELS_ID +# The ID of the private #bot-audit-logs channel where config change embeds are sent +AUDIT_CHANNEL_ID=YOUR_AUDIT_CHANNEL_ID_HERE +``` + +Save and exit: `Ctrl+X`, `Y`, `Enter` + +**Now create the actual .env file:** + +```bash +# Copy template to .env +cp /opt/firefrost-discord-bot/.env.template /opt/firefrost-discord-bot/.env + +# Edit .env file +nano /opt/firefrost-discord-bot/.env +``` + +**Option B: Create .env directly (alternative)** + +If you didn't create the template, create `.env` directly: ```bash nano /opt/firefrost-discord-bot/.env ``` -**Paste this template and fill in YOUR values:** +**Paste the template above and fill in YOUR values below.** -```env -# Discord Bot Token -DISCORD_TOKEN=your_bot_token_here - -# Discord OAuth2 Credentials -DISCORD_CLIENT_ID=your_oauth_client_id_here -DISCORD_CLIENT_SECRET=your_oauth_client_secret_here - -# Discord Server -GUILD_ID=your_discord_server_id_here - -# OAuth2 Callback URL -CALLBACK_URL=https://discord-bot.firefrostgaming.com/auth/discord/callback - -# Session Secret (generate with: openssl rand -base64 48) -SESSION_SECRET=generate_a_very_long_random_string_here - -# Admin Authorization (comma-separated Discord user IDs) -ALLOWED_ADMINS=HOLLYS_DISCORD_ID,MICHAELS_DISCORD_ID - -# Audit Log Channel (Discord channel ID for #bot-audit-logs) -AUDIT_CHANNEL_ID=your_audit_channel_id_here - -# Environment -NODE_ENV=production - -# Port (optional, defaults to 3100) -PORT=3100 -``` +--- **How to fill in each value:**