Overview
The SS Integrated Management Server requires several environment variables to connect to Discord, PostgreSQL, and configure system behavior. All configuration is done through a .env file in the application root directory.
Environment Variables
Discord Configuration
The following Discord-related variables are required for the bot to function:
DISCORD_BOT_TOKEN
The authentication token for your Discord bot application.
How to obtain:
Create Discord Application
Create Bot User
Go to the “Bot” section in the left sidebar and click “Add Bot”.
Copy Token
Under the bot’s username, click “Reset Token” and copy the generated token. Never share your bot token publicly. Treat it like a password. If exposed, regenerate it immediately from the Discord Developer Portal.
Enable Intents
Enable the following Privileged Gateway Intents:
Server Members Intent
Message Content Intent
DISCORD_GUILD_ID
The ID of the Discord server (guild) where your tournament is taking place.
How to obtain:
Enable Developer Mode
In Discord, go to User Settings > App Settings > Advanced and enable “Developer Mode”.
Copy Server ID
Right-click on your server icon in the server list and select “Copy Server ID”.
DISCORD_MATCHES_CHANNEL_ID
DISCORD_MATCHES_CHANNEL_ID
The ID of the Discord channel where match threads will be created for live match logs and communication.
How to obtain:
With Developer Mode enabled, right-click the channel name and select “Copy Channel ID”.
DISCORD_REFEREE_ROLE_ID
The ID of the Discord role assigned to tournament referees. This role will be pinged during !panic events and grants access to referee commands.
How to obtain:
Access Server Settings
Right-click your server icon and select “Server Settings” > “Roles”.
Copy Role ID
Right-click the referee role and select “Copy Role ID”.
DISCORD_ADMIN_ROLE_ID
The ID of the Discord role assigned to tournament administrators. This role has access to privileged commands like /stats.
Obtain this the same way as DISCORD_REFEREE_ROLE_ID.
Database Configuration
POSTGRESQL_CONNECTION_STRING
POSTGRESQL_CONNECTION_STRING
The connection string for your PostgreSQL database (v13+).
Format:
Host=<hostname>;Database=<database_name>;Username=<username>;Password=<password>;Port=<port>
Examples:
Local Development
Production
Docker Compose
POSTGRESQL_CONNECTION_STRING = Host = localhost ; Database = ss26db ; Username = ss ; Password = ss ; Port = 5432
Ensure your PostgreSQL server is running and accessible from the application host. The database must already exist before starting the application.
Localization Configuration
LANGUAGE
Sets the language used during automated matches and system messages.
Supported values:
en - English
es - Spanish (Español)
Creating the .env File
Copy the example file
From the application root directory:
Edit the .env file
Open .env in your preferred text editor and fill in all required values: DISCORD_BOT_TOKEN = MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhIjKl.MnOpQrStUvWxYzAbCdEfGhIjKlMnOpQrStUv
DISCORD_MATCHES_CHANNEL_ID = 1234567890123456789
DISCORD_REFEREE_ROLE_ID = 1234567890123456789
DISCORD_ADMIN_ROLE_ID = 1234567890123456789
DISCORD_GUILD_ID = 1234567890123456789
POSTGRESQL_CONNECTION_STRING = Host = localhost ; Database = ss26db ; Username = ss ; Password = ss ; Port = 5432
LANGUAGE = en
Verify configuration
Ensure all Discord IDs are numeric strings (18-20 digits) and the PostgreSQL connection string is valid.
Security Best Practices
Never commit .env files to version control
Use strong, unique passwords for PostgreSQL
Regenerate Discord bot tokens if exposed
Restrict database access to the application server only
Use environment-specific .env files (.env.development, .env.production)
Verification
After configuring your environment variables, test the configuration:
The application should:
Connect to PostgreSQL without errors
Display “Logged in as [BotName]#[Discriminator]” in the console
Show the bot as online in your Discord server
If you encounter connection errors, verify:
All IDs are correct and properly copied
The bot has been invited to your server with appropriate permissions
PostgreSQL is running and accessible
The database specified in the connection string exists