Skip to content

configuration

docisit edited this page Jul 27, 2026 · 2 revisions

⚙️ Configuration Guide

Complete reference for all environment variables and feature flags in ITG Media App.


Quick Start — .env Setup

# Copy the example file
cp .env.example .env

# Edit with your settings
nano .env

All configuration is driven by environment variables in the .env file (backend) and .env.local or .env.production (frontend).


🔧 Required Variables

These must be set for ITG Media App to function:

Variable Description
SECRET_KEY Django secret key — generate a unique random value
ALLOWED_HOSTS Comma-separated list of domain names the site will serve (e.g., yourdomain.com,localhost)
DATABASE_URL PostgreSQL connection string. Leave blank to use SQLite for local dev
REDIS_URL Redis connection (e.g., redis://127.0.0.1:6379/0). Required for WebSockets and LiveKit
LIVEKIT_API_KEY LiveKit API key — from cloud.livekit.io or your self-hosted server
LIVEKIT_API_SECRET LiveKit API secret
LIVEKIT_URL LiveKit WebSocket URL (e.g., wss://vdo.yourdomain.com)
FRONTEND_URL Frontend URL for CORS, email links, redirects (e.g., https://yourdomain.com)
INTERNAL_API_SECRET Random hex string for internal API calls (agent ↔ backend communication)

Generate a Secure SECRET_KEY

python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

Generate INTERNAL_API_SECRET

openssl rand -hex 32

🔄 Optional Variables

Database

Variable Default Description
DATABASE_URL (empty → SQLite) PostgreSQL connection. If blank, uses SQLite (not for production!)

LiveKit

Variable Default Description
LIVEKIT_API_URL http://localhost:7880 HTTP API URL — Django calls this for room management. Set to your LiveKit server's API endpoint

Django

Variable Default Description
DEBUG True Never enable in production! Controls error pages and static file handling
DJANGO_ENV development development or production

Admin Panel

Variable Default Description
ADMIN_URL admin/ Change the admin URL path to hide it from bots (e.g., my-secret-admin/)
ADMIN_IP_WHITELIST 127.0.0.1 Comma-separated IPs allowed to access /admin/. Leave empty to disable IP check

⚠️ Security Tip: Always change ADMIN_URL from the default admin/ and set ADMIN_IP_WHITELIST to your static IP before going to production.

Email

Variable Default Description
EMAIL_HOST localhost SMTP server hostname
EMAIL_PORT 1025 SMTP port
EMAIL_USE_TLS False Enable TLS for SMTP
EMAIL_HOST_USER (empty) SMTP username
EMAIL_HOST_PASSWORD (empty) SMTP password
DEFAULT_FROM_EMAIL noreply@yourdomain.com From address for system emails

For development, emails are printed to the console by default. Set up a real SMTP server (SendGrid, Mailgun, AWS SES) for production.

RTMP Streaming

Variable Default Description
RTMP_SERVER_URL rtmp://localhost:1935 RTMP server for stream relay
RTMP_INGEST_APPLICATION ingest RTMP ingest application name
RTMP_LIVE_APPLICATION live RTMP live application name
RTMP_GUEST_STREAM_PREFIX guest_ Prefix for guest RTMP streams
RTMP_OBS_STREAM_NAME obs OBS RTMP stream name
RTMP_COMPOSED_STREAM_NAME composed Composed output stream name

Social Streaming Keys

Variable Default Description
YOUTUBE_RTMP_URL (empty) YouTube RTMP ingest URL
FACEBOOK_RTMP_URL (empty) Facebook RTMP ingest URL
TIKTOK_RTMP_URL (empty) TikTok RTMP ingest URL

Cloudflare Turnstile (CAPTCHA)

Variable Default Description
TURNSTILE_SITE_KEY (empty) Cloudflare Turnstile site key (leave blank to disable)
TURNSTILE_SECRET_KEY (empty) Cloudflare Turnstile secret key

Get keys at Cloudflare Turnstile Dashboard.

NextAuth.js (Frontend)

Variable Default Description
NEXTAUTH_URL http://localhost:3000 Frontend base URL
NEXTAUTH_SECRET (to be generated) NextAuth.js JWT signing secret

🏷️ Feature Flags

Feature flags allow you to enable/disable optional modules without modifying code.

Flag Default What it Controls
SPORTS_MODULE_ENABLED False Athlete stats, drills, scouting, leaderboards, verifications
STREAMING_PLATFORMS_ENABLED True Multi-platform streaming (YouTube, Facebook, etc.)
STREAMING_MULTICAST_ENABLED True Multicast streaming support
STREAMING_OWNCAST_ENABLED False Owncast as streaming destination
FFMPEG_COMPOSITION_ENABLED True FFmpeg video composition for portrait/overlay layouts

How Feature Flags Work

Flags are set in .env:

# Enable the Sports Module
SPORTS_MODULE_ENABLED=True

When a flag is off, the Django backend:

  • Skips registering URL patterns for that feature
  • Hides admin model registrations
  • Excludes extra serializer fields
  • But keeps models in the database (no migration complexity)

💡 Models are always in the database regardless of flag state. The flags only control API exposure and UI visibility.

SPORTS_MODULE_ENABLED — What's Included

When True, these features become available:

Feature Details
Sports Management List/create sports with recruiter attributes
Athlete Stats Record stats with history, trend data
Leaderboards Per-stat leaderboards across all athletes
Drills Drill library (CRUD)
Verifications Video proof for stat verification
Extra Profile Fields Height, weight, 40-yard time, vertical jump, GPA, etc.
Coach Verification Verified coach badges, years of experience, certifications

🖥️ Frontend Configuration

The Next.js frontend reads from frontend/.env.local (dev) or frontend/.env.production (prod):

# frontend/.env.local
NEXT_PUBLIC_API_URL=https://api.yourdomain.com
NEXT_PUBLIC_LIVEKIT_URL=wss://vdo.yourdomain.com
NEXT_PUBLIC_SITE_URL=https://yourdomain.com

📋 Complete .env Example

Here's a fully-commented production example:

# ===========================================================
# .env — ITG Media App Production Configuration
# ===========================================================

# ---- Django ----
DJANGO_ENV=production
SECRET_KEY=django-insecure-<your-generated-64-char-key>
DEBUG=False
ALLOWED_HOSTS=donoconnor.com,www.donoconnor.com,localhost

# ---- Database ----
DATABASE_URL=postgres://media_user:strongpassword@localhost:5432/media_db

# ---- Redis ----
REDIS_URL=redis://127.0.0.1:6379/0
REDIS_PASSWORD=

# ---- LiveKit ----
LIVEKIT_API_KEY=APIxxxxxxxxxxxxx
LIVEKIT_API_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
LIVEKIT_URL=wss://vdo.donoconnor.com
LIVEKIT_API_URL=https://vdo.donoconnor.com

# ---- Internal Security ----
INTERNAL_API_SECRET=<openssl-rand-hex-32-output>

# ---- Admin ----
ADMIN_URL=secure-panel/
ADMIN_IP_WHITELIST=203.0.113.1,203.0.113.2

# ---- Frontend URLs ----
FRONTEND_URL=https://donoconnor.com

# ---- Email (SendGrid / Mailgun / AWS SES) ----
EMAIL_HOST=smtp.sendgrid.net
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=apikey
EMAIL_HOST_PASSWORD=SG.xxxxxxxxxxxxxxxxxxxx
DEFAULT_FROM_EMAIL=noreply@donoconnor.com

# ---- RTMP ----
RTMP_SERVER_URL=rtmp://localhost:1935

# ---- Social Streaming ----
YOUTUBE_RTMP_URL=rtmp://a.rtmp.youtube.com/live2
FACEBOOK_RTMP_URL=rtmp://live-api-s.facebook.com:80/rtmp
TIKTOK_RTMP_URL=rtmp://live.tiktok.com/live

# ---- Feature Flags ----
SPORTS_MODULE_ENABLED=True
STREAMING_PLATFORMS_ENABLED=True
STREAMING_MULTICAST_ENABLED=True
FFMPEG_COMPOSITION_ENABLED=True

# ---- Turnstile ----
TURNSTILE_SITE_KEY=0x4AAAAAAxxxxxxxxxxxx
TURNSTILE_SECRET_KEY=0x4AAAAAAxxxxxxxxxxxxxxxxxxxxxxxx

# ---- NextAuth.js ----
NEXTAUTH_URL=https://donoconnor.com
NEXTAUTH_SECRET=<another-random-secret-here>

✅ Configuration Checklist

  • SECRET_KEY is set and unique
  • DEBUG=False in production
  • ALLOWED_HOSTS includes your production domain
  • DATABASE_URL points to your PostgreSQL instance
  • REDIS_URL is configured and Redis is running
  • All LiveKit variables are set with valid keys
  • FRONTEND_URL matches your actual domain
  • ADMIN_URL has been changed from the default admin/
  • ADMIN_IP_WHITELIST is set to your IP address(es)
  • Email settings are configured for production (not console backend)
  • Social RTMP keys are filled in if using simulcast
  • Feature flags are set to your preferred configuration

⏭️ Next Steps


← Back to Wiki Home

Clone this wiki locally