From 8ea691ec0587bfe69f1d775367ae29e9352cc10a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Mar 2026 13:48:02 +0000 Subject: [PATCH] feat: Add .env.template to Discord Bot Admin Panel guide - DEPLOYMENT PACKAGE COMPLETE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ADDED: Complete .env.template file to Part 4 Step 2 .env.template Features: - Clear section headers (Server Config, Discord Bot, OAuth2, Security) - Detailed comments explaining each variable - Example values showing format - Instructions on where to find each value - Security reminder: DO NOT commit .env to version control Two-Option Approach: - Option A (Recommended): Create .env.template first, then copy to .env - Option B (Alternative): Create .env directly Variables Included (11 total): 1. NODE_ENV (production/development) 2. PORT (internal port for Node app) 3. SESSION_SECRET (random string for cookie encryption) 4. DISCORD_TOKEN (bot token from Developer Portal) 5. GUILD_ID (Discord server ID) 6. DISCORD_CLIENT_ID (OAuth2 client ID) 7. DISCORD_CLIENT_SECRET (OAuth2 client secret) 8. CALLBACK_URL (OAuth2 redirect URL) 9. ALLOWED_ADMINS (Holly + Michael Discord user IDs) 10. AUDIT_CHANNEL_ID (#bot-audit-logs channel ID) Security Notes: - Template shows format without exposing secrets - Actual .env must be chmod 600 - Actual .env owned by firefrost-bot user - DO NOT commit .env to git Template provided by: Gemini (Google AI) - March 23, 2026 STATUS: DEPLOYMENT PACKAGE 100% COMPLETE All code files ready: ✅ bot.js (350+ lines) ✅ index.html (Fire/Frost branded) ✅ style.css (mobile-responsive) ✅ app.js (frontend logic) ✅ .env.template (complete) All configuration ready: ✅ Systemd service file ✅ Nginx reverse proxy config ✅ Let's Encrypt SSL commands ✅ Environment variable template All documentation ready: ✅ Complete deployment guide (2400+ lines) ✅ Step-by-step walkthrough ✅ Troubleshooting guide ✅ Holly's usage guide READY FOR PRODUCTION DEPLOYMENT (March 24, 2026) Chronicler #40 --- docs/guides/discord-bot-admin-panel.md | 98 ++++++++++++++++++-------- 1 file changed, 67 insertions(+), 31 deletions(-) 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:**