Skip to content
Allay

WikiAllay Server

Environment variables

The environment holds only what the backend can't start without. Everything else—keys, models, limits—is a setting in the admin panel.

#Required

Variable What it does
MONGODB_URI Where MongoDB lives, like mongodb://user:password@allay-mongo:27017/?authSource=admin. The backend won't start without it
MONGODB_DATABASE The database's name, like allay. The backend won't start without it
Variable What it does Default
REDIS_URL Where Redis lives, like redis://:password@allay-redis:6379/0 redis://localhost:6379
SELFHOSTED 1 turns billing off: your plugins run on this backend's key, and /allay init sets up the panel. See Who pays for the model unset, so billing is on
PLUGIN_TOKEN Self-hosted: the token every plugin sends as server.token, at least 24 characters. Without it the backend answers no plugin. A setting too, but /allay init needs it before the panel exists unset
SECRETS_KEY Any string. It seals the secrets you save in the panel (keys, the bot token) with AES-GCM, and keys the players' pseudonyms in the statistics unset: the backend makes a key in /data/secrets.key
PUBLIC_URL The address people open in a browser, with any path prefix. A setting, but set it here on the first start so the setup link points to your backend API_URL, which is https://allay.chat

Without SECRETS_KEY, mount /data as a volume. Otherwise the key file dies with the container, and the secrets saved in the panel die with it.

#Optional

Variable What it does Default
PORT The port to listen on 3000
HOST The address to listen on inside the container; publish the port on 127.0.0.1 instead of changing it 0.0.0.0
SECRETS_KEY_FILE Where the key file lives when SECRETS_KEY is unset /data/secrets.key
ADMIN_USERNAME with ADMIN_PASSWORD or ADMIN_PASSWORD_HASH An owner account defined here. It turns setup off, and the panel can't change it. ADMIN_PASSWORD_HASH is an argon2id hash from Bun.password unset
APP_VERSION The version /api/health reports. The image build sets it dev
TZ The time zone of the logs UTC

#Settings in the environment

Any setting from the settings table can also come from a variable of the same name, such as OPENROUTER_API_KEY. A variable that is set wins and locks its field in the panel (“set by the environment”), so deployments from before 5.7 keep working. Import from the environment in the panel copies those values into MongoDB; after that, remove the variables.

The old SYSTEM_MESSAGE* variables are no longer read: the prompts ship inside the build.

Next: Admin panel and settings