Skip to content

Site Configuration ​

These settings have no admin-panel controls and are managed by the deployer. Change the site name, icon, and palette under Site appearance in the admin panel.

Message Retention ​

MESSAGE_RETENTION_DAYS controls how long messages are kept, measured from creation. The current default is 15 days. Use a positive integer such as 7 or 30.

GitHub Actions ​

  1. Open the fork's Settings → Secrets and variables → Actions → Variables.
  2. Click New repository variable.
  3. Set Name to MESSAGE_RETENTION_DAYS and Value to 30, using digits only.
  4. Run Actions → 00 Deploy Worker → Run workflow.

This is a regular Variable, not a Secret. Later deployments reuse it; without it, the default is 15 days.

Cloudflare Dashboard ​

Open Workers & Pages → your Worker → Settings → Variables and Secrets. Add or edit MESSAGE_RETENTION_DAYS as Text, then save and deploy.

For Actions deployments, also set the repository variable above. Subsequent Actions deployments use the repository value.

Manual Deployment ​

Edit the existing [vars] section of the wrangler.toml you deploy:

toml
[vars]
MESSAGE_RETENTION_DAYS = "30"

Redeploy to apply it. A local shell environment variable alone does not change the deployed Wrangler configuration.

Deletion Schedule ​

Cleanup runs daily around 19:00 UTC and deletes expired messages. Attachments are checked for remaining references before deletion. Backlogs are processed in batches.

Reducing retention affects existing history; deleted messages cannot be restored. 0 does not disable cleanup: the Worker falls back to its default, and Actions rejects that value.

The default changed to 15 days in 2.17.2. Existing explicit values such as 7 remain effective until you change them.

Other Runtime Settings ​

ParameterDefaultPurpose
MAX_FILE_SIZE20971520 (20 MiB)Maximum uploaded file size in bytes
ALLOWED_FILE_TYPESimage/,video/,audio/,application/pdf,text/Comma-separated MIME prefix allowlist
SITE_ORIGINSEmptyComma-separated site origins for recognizing historical site-icon file URLs
SOFT_DELETE_RETENTION_DAYS60Retention for soft-deleted users, channels, and related records
ORPHAN_UPLOAD_RETENTION_DAYS1Retention for uploads without application references
ADMIN_USERNAMESadminReserved registration names; see Administrator Setup to create accounts

These settings currently do not read same-named GitHub Repository Variables:

  • Actions: edit the existing [vars] in your fork's wrangler.example.toml, commit, and deploy.
  • Manual deployment: edit your deployed wrangler.toml and redeploy.
  • Temporary dashboard change: publish a Worker Text variable. The next deployment restores the configuration-file value.

See Attachments and Storage for file-type examples. Example site origins:

toml
SITE_ORIGINS = "https://chat.example.com,https://chat-alt.example.com"

Include the scheme and hostname, without a path. This identifies historical icon references during cleanup; newly saved icons use object keys directly.

Advanced Cleanup Settings ​

These limit work per cleanup invocation. Keep the defaults for ordinary operation; edit them through the same configuration files as above.

ParameterDefaultMeaning
GC_BATCH_SIZE90Batch size
GC_MAX_BATCHES_PER_RUN20Maximum rounds
GC_INTERNAL_OPERATION_BUDGET900Combined D1 API and R2 internal operation budget
GC_D1_STATEMENT_BUDGET1200D1 SQL statement budget
GC_R2_OPERATION_BUDGET300R2 operation budget
R2_DELETE_MAX_RETRY8R2 deletion retry limit

Cron runs every 15 minutes; message cleanup runs only at the daily designated time. Changes to the Cron expression also require reviewing the cleanup time check in worker/src/index.js.

Features Using Secrets ​

Configure TURN relay and server-side encryption using their separate Secret setup guides.

Built on Cloudflare · Designed for self-hosting