Configure

Configuration

How Kanesh reads settings, plus the server, logging, database, owner and agent variables.

Kanesh is configured with environment variables. Every variable is optional: leave it out and the default applies. The full file with every variable is on Environment file.

How settings are read

  • Docker: pass variables with -e NAME=value or an env_file in Compose.
  • Go process: export them in your shell first. Kanesh does not load .env files by itself.
  • Studio: many security, access and email settings can also be changed in Settings. A variable that is set wins and shows as read-only in Studio. Leave it unset to manage it from Studio.

Server and data

VariableDefaultWhat it does
HOST127.0.0.1Address to listen on. Use 0.0.0.0 inside a container.
PORT8080Port for Studio and the API.
DATA_DIR.data (/data in the image)Folder for the SQLite file, uploads and the claim token. Back it up.
SHUTDOWN_TIMEOUT10sHow long running requests may finish before shutdown, 1s to 5m.

Logging

Logs go to stderr. They never include request bodies, query values, passwords or record data.

VariableDefaultWhat it does
LOG_LEVELinfodebug, info, warn or error.
LOG_FORMATjsonjson for log tools, text for reading in a terminal.
LOG_SLOW_REQUEST1sRequests at least this slow log as a warning. 0 turns it off.

Database

VariableDefaultWhat it does
DATABASE_DRIVERsqlitesqlite, postgres or mysql.
DATABASE_URLunsetConnection for PostgreSQL (a URL) or MySQL (a go-sql-driver DSN, not mysql://).
SQLITE_PATHDATA_DIR/kanesh.dbCustom path for the SQLite file.

If an external database fails, Kanesh stops. It never falls back to SQLite. See Database setup.

First owner

A new install is claimed once by its owner. These variables create or secure that owner.

VariableDefaultWhat it does
BOOTSTRAP_TOKENunsetYour own claim secret, 32 to 256 characters. Without it, a one-time token is written to DATA_DIR/claim-token.
ADMIN_EMAILunsetCreates the owner on a new install only.
ADMIN_PASSWORDunsetPassword for that owner. A restart never resets it.
ADMIN_PASSWORD_FILEunsetReads the password from a file, such as a mounted secret. Safer than ADMIN_PASSWORD.
DEMO_MODEfalseShows the owner email and password on the login screen. Public demos only.

Note: The owner can do everything, like a super admin. Use DEMO_MODE=true only on a separate, throwaway install with sample data. Never in production.

Agents and tokens

VariableDefaultWhat it does
MCP_ENABLEDfalsetrue turns on the read-only MCP endpoint for agents. See MCP for agents.
AUTH_TOKEN_HEADERunsetExtra header for raw tokens, such as X-Api-Key. Authorization: Bearer always works.

Troubleshooting

  • .env has no effect when running Go: export the variables before starting the process.
  • A setting is read-only in Studio: the matching variable is set. Remove it to manage the setting in Studio.
  • Startup fails after a change: an invalid value stops startup on purpose. Check it against Environment file.

Next steps

Buy me a coffee