Skip to content

Configuration Reference

This page is aimed at listing all the configuration variables of your Discord Analytics Instance. You'll find here details about which variable is what and how to configure the API and the Website.

API

Discord Analytics' API uses environment variables to configure common features and a rust configuration file for constants that would allow to customize even more your instance (requires a custom build) but we won't detail theses here as they're not intended to be updated. You can download these two files from the repository to get a template :

General variables

Most of these variables are required to use the API no matter which variant you choose to use.

VariableTypeRequiredDefault valueDescription
PORTintno3001The port where the API is listening
API_URLstringnoThe endpoint where the API is available (If you don't use custom images, this should be $CLIENT_URL/api)
CLIENT_URLstringyesThe endpoint where the Website is available
ADMINSstringyesA list of Discord IDs of the admins separated by a comma
DATABASE_URLstringyesThe MongoDB connection string
DATABASE_NAMEstringyesThe MongoDB database name (will be created if it does not exists)
DISCORD_TOKENstringyesThe token of your Discord app (required for DM notifications and bot fetches)
JWT_SECRETstringyesThe JSON Web Tokens secret (can be generated using the openssl rand -base64 32 command)
ENABLE_REGISTRATIONSbooleannotrueWhether you want to enable new registrations or not
CLIENT_SECRETstringyesThe Client Secret of your Discord app (required for OAuth2)
CLIENT_IDstringyesThe ID of your Discord app (required for OAuth2)

OpenTelemetry variables

These variables are part of the otlp feature which is included in the full variant.

VariableTypeRequiredDescription
OTLP_ENDPOINTstringyesThe OpenTelemetry endpoint that will receive logs and traces
OTLP_TOKENstringyesThe OpenTelemetry endpoint that will receive logs and traces
OTLP_STREAMstringyesThe name of the OpenTelemetry stream

Actix Limitation

These variables are part of the rate_limiting feature which is included in the full variant.

VariableTypeRequiredDefault valueDescription
REDIS_URLstringnoredis://localhost:6379The connection URL of your Redis instance
MS_PER_REQUESTintno100INSERT DESCRIPTION HERE
BURST_LIMITintno10INSERT DESCRIPTION HERE

SMTP

These variables are part of the mails feature which is included in the mails, reports and full variants.

VariableTypeRequiredDescription
SMTPstringyesThe hostname of your SMTP server
SMTP_MAILstringyesThe email address that will send the emails
SMTP_USERstringyesThe username to connect to your SMTP server
SMTP_PASSWORDstringyesThe password to connect to your SMTP server

R2

These variables are part of the reports feature which is included in the reports and full variants.

INFO

Currently Discord Analytics only supports Cloudflare R2 as a storage provider. Let us know if you want to see a wider S3 compatible storage support.

VariableTypeRequiredDescription
R2_BUCKET_NAMEstringyesThe name of your bucket
R2_ACCOUNT_IDstringyesThe Access Key ID of your User API Token
R2_BUCKET_ENDPOINTstringyesThe API endpoint of your R2 account (should be something like https://<accountId>.r2.cloudflarestorage.com)
R2_PUBLIC_BUCKET_ENDPOINTstringyesThe public endpoint of your bucket
CLOUDFLARE_IDstringyesYour Cloudflare account ID
CLOUDFLARE_TOKENstringyesThe Secret Access Key of your User API Token

Website

Discord Analytics' Website uses a config.js file to store variables required for its operation. You'll only need to update this file if you use some special setup that goes beyond the official one or if your want to setup a dev environment.

To update the configuration file, you'll need to download the original one to host:

bash
wget -o config.js https://github.com/DiscordAnalytics/website/raw/refs/heads/master/public/config.js

And once you updated what you needed to update, you can mount it to the container by updating your docker-compose.yml file:

yml
  app:
    # ...
    volumes:
      - ./config.js:/app/dist/public/config.js:ro
    # ...
VariableTypeRequiredDefault valueDescription
apiBaseUrlstringyesThe base URL of the API
posthogProjectTokenstringnoThe Posthog project token
posthogApiHoststringnoThe Posthog proxy host