Files
ECS-FullStack/backend/.env.example

83 lines
3.1 KiB
Plaintext

# Example backend/.env for ECS-FullStack
# Copy this file to backend/.env and fill values before running the backend
# Postgres connection (required)
# Example formats:
# postgres://user:password@host:5432/dbname
# postgresql://user:password@localhost:5432/dbname
DATABASE_URL=postgres://postgres:password@127.0.0.1:5432/ecs_fullstack
# Discord OAuth / Bot
DISCORD_CLIENT_ID=your_discord_client_id
DISCORD_CLIENT_SECRET=your_discord_client_secret
DISCORD_BOT_TOKEN=your_discord_bot_token
# Frontend base URL (where the frontend is served). Used for OAuth redirect and dashboard links.
FRONTEND_BASE=https://discordbot.YOURDOMAIN.com
# Host/port to bind the backend server (bind to 0.0.0.0 or your Tailscale IP as needed)
HOST=0.0.0.0
PORT=3002
# CORS origin - set to your frontend origin for tighter security (or '*' to allow all)
# Example: https://discordbot.YOURDOMAIN.com
CORS_ORIGIN=http://127.0.0.1:3001
# Twitch API (for the watcher and proxy)
TWITCH_CLIENT_ID=your_twitch_client_id
TWITCH_CLIENT_SECRET=your_twitch_client_secret
TWITCH_POLL_INTERVAL_MS=5000
# Optional bot push receiver settings - allows backend to notify a remote bot process
# BOT_PUSH_PORT if you run the bot on another host and want the backend to push settings
BOT_PUSH_PORT=
BOT_PUSH_URL=
BOT_SECRET=
# Optional logging level: debug | info | warn | error
LOG_LEVEL=info
# Example backend .env
# Set the host/interface to bind to (for Tailscale use your 100.x.y.z address)
HOST=0.0.0.0
PORT=3002
# Optional: fully-qualified base URLs
BACKEND_BASE=http://100.x.y.z:3002
FRONTEND_BASE=http://100.x.y.z:3000
# CORS origin (frontend origin) - set to frontend base for tighter security
CORS_ORIGIN=http://100.x.y.z:3000
# Postgres connection (replace user, password, host, port, and database name)
# Example for your Tailscale IP 100.111.50.59:
DATABASE_URL=postgres://dbuser:dbpass@100.111.50.59:5432/ecs_db
# Invite token secret (short-lived HMAC tokens for invite delete protection)
INVITE_TOKEN_SECRET=replace-with-a-long-random-secret
# Discord credentials
DISCORD_CLIENT_ID=your_client_id
DISCORD_CLIENT_SECRET=your_client_secret
DISCORD_BOT_TOKEN=your_bot_token
# Encryption key for backend db.json (only needed if you plan to decrypt/migrate old data)
ENCRYPTION_KEY=pick-a-long-random-string
# --- Twitch API (optional; required for Live Notifications)
# Register an application at https://dev.twitch.tv to obtain these
TWITCH_CLIENT_ID=your_twitch_client_id
TWITCH_CLIENT_SECRET=your_twitch_client_secret
# Poll interval in milliseconds for the bot watcher (default = 30000 = 30s)
TWITCH_POLL_INTERVAL_MS=30000
# --- Bot push (optional) - used when backend and bot run on different hosts
# If the bot runs on a separate host/process, set BOT_PUSH_URL to the public
# URL the bot exposes for receiving settings pushes (backend will POST there)
# Example: BOT_PUSH_URL=http://bot-host:4002
BOT_PUSH_URL=
# Shared secret used to secure backend -> bot pushes. Must match BOT_SECRET in the bot env.
BOT_SECRET=replace-with-a-long-random-secret
# When BOT_PUSH_PORT is set, the bot starts a small HTTP endpoint to accept pushes
# (only needed if bot runs separately and you want immediate pushes).
BOT_PUSH_PORT=4002