Skip to main content
Faculty Bot requires several environment variables to be configured in a .env file at the root of your project.

Required Variables

DISCORD_TOKEN
string
required
Your Discord bot token. Get this from the Discord Developer Portal.
DISCORD_TOKEN=your_bot_token_here
DATABASE_URL
string
required
PostgreSQL database connection string. Format: postgres://username:password@host/database
DATABASE_URL=postgres://faculty_manager:averysecurepasswordyes@localhost/faculty_manager
Make sure PostgreSQL is installed and running before starting the bot.
PREFIX
string
required
The command prefix for the bot. This is also configured in config.json.
PREFIX=>

Email Configuration

Email configuration is required for the student verification system to work.
SEND_FROM_ADDRESS
string
required
The email address that verification emails will be sent from.
SEND_FROM_ADDRESS=facultybot@yourdomain.com
MAIL_USERNAME
string
required
SMTP authentication username (usually your email address).
MAIL_USERNAME=facultybot@yourdomain.com
MAIL_PASSWORD
string
required
SMTP authentication password.
MAIL_PASSWORD=your_smtp_password
Keep this secure! Never commit your .env file to version control.
SMTP_SERVER
string
required
SMTP server hostname.
SMTP_SERVER=smtp.gmail.com
SMTP_PORT
number
required
SMTP server port (typically 587 for TLS or 465 for SSL).
SMTP_PORT=587

Optional Configuration

RUST_LOG
string
Configure logging levels for the bot. Recommended for debugging and monitoring.
RUST_LOG="info,sqlx=error,sqlx::query=error,sqlx::query_as=error"
Available log levels:
  • error - Only errors
  • warn - Warnings and errors
  • info - General information (recommended)
  • debug - Detailed debugging information
  • trace - Very verbose tracing
INFLUX_TOKEN
string
InfluxDB authentication token for logging bot metrics (latency, etc.).
INFLUX_TOKEN=your_influx_token
This is used for monitoring bot performance. The bot will still work without it.

Example .env File

.env
DISCORD_TOKEN=MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhJkLm.NoPqRsTuVwXyZaBcDeFgHiJkLmNoPqRsTuVwXyZ

DATABASE_URL=postgres://faculty_manager:averysecurepasswordyes@localhost/faculty_manager

PREFIX=>

SEND_FROM_ADDRESS=facultybot@university.edu
MAIL_USERNAME=facultybot@university.edu
MAIL_PASSWORD=your_secure_password_here
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587

# Optional but recommended for logs
RUST_LOG="info,sqlx=error,sqlx::query=error,sqlx::query_as=error"
Never share your .env file or commit it to Git! Add .env to your .gitignore file.

Build docs developers (and LLMs) love