Home / Advanced / Configuration Reference

Configuration Reference

Command-line flags and environment variables for running XianScan on servers and in scripts.

1. Command-Line Flags

FlagWhat it does
--lanAccept connections from other devices (they need the access token). Overrides the setting in the app.
--print-tokenPrint the access token and exit.
--extract-onlyUnpack the web app and exit (used when building the Docker image).
--ml-only, -mRun only the engine, without the web studio (for development).
--dev, -dDevelopment mode (for working on XianScan itself).

2. Environment Variables

Most people never need these; everything else is in Settings.

Network and access

VariableDefaultWhat it does
PORT8124Port of the web studio.
XIANSCAN_BINDnot setlan or local. Overrides the LAN setting in the app.
XIANSCAN_TRUST_LOOPBACKonSet to 0 so that even requests from the same machine need the token.
ML_PORT8123Internal engine port (loopback only).

Storage

VariableDefaultWhat it does
XDG_DATA_HOME (Linux)~/.local/shareMoves the whole XianScan folder, including the database and token. This is the right way to move data on Linux.
DATABASE_PATH<data>/xianscan.dbLocation of the SQLite database only.
DATA_ROOT<data>Location of images and fonts only. The database and access token stay in the data folder, so prefer XDG_DATA_HOME.
XIANSCAN_APP_DIR<XianScan>/appWhere the web app is unpacked.

Hardware and performance

VariableDefaultWhat it does
MT_DEVICEnot setForce cpu, cuda, dml or coreml while the device setting is Auto.
ONNX_THREADSCPU cores, at most 8CPU threads per model. Raise it on large servers.
ONNX_GPU_THREADSCPU cores, at most 4CPU threads that feed a GPU model.
ORT_CUDA_MEM_LIMIT_MBautomaticGPU memory limit per model (CUDA). The limit set in the app wins.
PIPELINE_PAGE_CONCURRENCY3Pages processed in parallel within a chapter.

Limits and logging

VariableDefaultWhat it does
XIANSCAN_MAX_IMAGE_MP100Largest accepted image, in megapixels.
XIANSCAN_MAX_RESLICE_MP200Largest re-slice canvas, in megapixels.
RUST_LOGinfoEngine log level (debug, warn...).
LOG_REQUESTSoffSet to 1 to log every web request.