Files
firefrost-services/services/arbiter-3.0/.env.example
Claude Code 328e9ba613 Task #138: Wiki.js subscriber tier sync via GraphQL (REQ-2026-04-15-subscriber-wiki-auth)
- src/services/wikijsSync.js: GraphQL client for Wiki.js at subscribers.firefrostgaming.com
  - syncWikiUser(discordId, username, tierLevel): creates user if not exists, updates group if exists
  - demoteToAwakened(discordId): downgrades group on cancellation/chargeback/refund
  - Email convention: {discordId}@firefrost.local (unique internal addresses)
  - Tier → group mapping: 1=Awakened, 2=Elemental, 3=Knight, 4=Master, 5=Legend, 6=Sovereign
  - Silent-fail: never breaks the Stripe webhook
- src/routes/stripe.js: hooked into 4 lifecycle paths:
  - checkout.session.completed → syncWikiUser (non-blocking)
  - customer.subscription.deleted → demoteToAwakened
  - charge.dispute.created (chargeback) → demoteToAwakened
  - charge.refunded (refund ban) → demoteToAwakened
- .env.example: added WIKIJS_URL, WIKIJS_API_KEY, DISCORD_ISSUE_WEBHOOK_URL

PRE-REQ: Michael must create 6 groups in Wiki.js admin + generate API key before deploy.
2026-04-16 00:15:55 -05:00

40 lines
1.2 KiB
Plaintext

# Discord Core
DISCORD_BOT_TOKEN=your_bot_token
GUILD_ID=your_guild_id
DISCORD_CLIENT_ID=your_client_id
DISCORD_CLIENT_SECRET=your_client_secret
# OAuth & Admin
REDIRECT_URI=https://discord-bot.firefrostgaming.com/auth/discord/callback
ADMIN_USERS=discord_id_1,discord_id_2
SESSION_SECRET=your_secure_session_secret
PORT=3500
NODE_ENV=production
# PostgreSQL Database
DB_USER=arbiter
DB_HOST=127.0.0.1
DB_NAME=arbiter_db
DB_PASSWORD=your_secure_password
DB_PORT=5432
# Pterodactyl Integration
PANEL_URL=https://panel.firefrostgaming.com
PANEL_CLIENT_KEY=ptlc_...
PANEL_APPLICATION_KEY=ptla_...
MINECRAFT_NEST_IDS=1,6,7
# Stripe Integration
STRIPE_SECRET_KEY=sk_test_... # or sk_live_... for production
STRIPE_WEBHOOK_SECRET=whsec_... # Get from Stripe Dashboard webhook settings
BASE_URL=https://discord-bot.firefrostgaming.com # For checkout redirect URLs
# Wiki.js Subscriber Wiki (subscribers.firefrostgaming.com)
# Generate key in Wiki.js Admin → API Access. Groups (Awakened thru Sovereign)
# must be pre-created in Wiki.js admin panel before syncing.
WIKIJS_URL=https://subscribers.firefrostgaming.com
WIKIJS_API_KEY=
# Discord Webhooks (optional — silent-skip if unset)
DISCORD_ISSUE_WEBHOOK_URL=