Environment Variables

Complete reference for all environment variables used by Ticketo.


Required Variables

These must be set for the bot to start.

Variable
Description
Example

DISCORD_TOKEN

Discord bot token from the Developer Portal

MTIz...

DISCORD_SECRET

Discord OAuth2 client secret

abc123...

ENCRYPTION_KEY

AES encryption key (48+ hex characters). Generate with npm run keygen

a1b2c3d4...

DB_PROVIDER

Database provider: postgresql, mysql, or sqlite

postgresql

DB_CONNECTION_URL

Database connection string (not required for SQLite)

postgresql://user:pass@localhost:5432/ticketo

HTTP_EXTERNAL

Public-facing URL of the bot's HTTP server (no trailing slash)

https://tickets.example.com

HTTP_HOST

Address to bind the HTTP server to (not a URL)

0.0.0.0

HTTP_PORT

Port for the HTTP server

8169

HTTP_EXTERNAL, HTTP_HOST, and HTTP_PORT are not required if SKIP_HTTP=true.


Optional Variables

HTTP

Variable
Default
Description

HTTP_INTERNAL

Same as HTTP_EXTERNAL

Internal URL for inter-service communication (e.g., http://api:8169)

HTTP_TRUST_PROXY

false

Set to true when behind a reverse proxy (Nginx, Cloudflare)

SKIP_HTTP

Set to true to disable the HTTP server (bot-only mode)

Discord

Variable
Default
Description

SUPER

JSON array of Discord user IDs with operator (level 4) privileges. Example: ["123456789"]

PUBLIC_BOT

Set to true if the bot is public (affects invite links and behavior)

PUBLISH_COMMANDS

Set to true to register slash commands globally instead of per-guild

BOT_PREFIX

?

Default prefix for legacy prefix commands

INVALIDATE_TOKENS

ISO date string; JWT tokens created before this date are rejected

OVERRIDE_ARCHIVE

Override the archive setting for all categories

API Service (Standalone)

Variable
Default
Description

BOT_USER_ID

Required for standalone API mode. The bot's Discord user ID

Database

Variable
Default
Description

DATABASE_URL

Alternative to DB_CONNECTION_URL (Prisma convention)

Redis

Variable
Default
Description

REDIS_URL

Redis connection URL. Required for 3-service mode. Example: redis://localhost:6379

REDIS_PASSWORD

Redis password (if not included in the URL)

Chargebee (Premium Billing)

Variable
Default
Description

CHARGEBEE_SITE

Chargebee site name (e.g., mysite)

CHARGEBEE_API_KEY

Chargebee API key

CHARGEBEE_WEBHOOK_SECRET

Secret for verifying Chargebee webhook signatures

CHARGEBEE_PLAN_ID

premium-monthly

Chargebee plan ID for the premium subscription

Sharding

Variable
Default
Description

TOTAL_SHARDS

auto

Total Discord shard count (auto or a number)

SHARDS_PER_CLUSTER

4

Number of shards per cluster process

Sentry (Error Tracking)

Variable
Default
Description

SENTRY_DSN

Sentry DSN for error tracking

Miscellaneous

Variable
Default
Description

NODE_ENV

production

Node.js environment (production or development)

LOG_LEVEL

info

Logging level

DOCKER

Set automatically in Docker containers

DEFAULT_EMBED_COLOR

#252B4C

Default color for Discord embeds (hex)


Database Connection URLs

PostgreSQL

MySQL

SQLite


Docker Compose Environment

When using Docker Compose, environment variables are set in the docker-compose.yml or a .env file. Each service needs its own subset:

Bot Service

API Service

Portal Service


Generating an Encryption Key

Run the keygen script to generate a secure encryption key:

This outputs a random hex string of sufficient length. Copy it into your ENCRYPTION_KEY variable.

Warning: If you change or lose the encryption key after data has been encrypted, all encrypted data (transcripts, topics, usernames) becomes permanently unrecoverable.


Validation

Environment variables are validated on startup in src/env.jsarrow-up-right. If a required variable is missing or invalid, the process exits with an error message.

Last updated