Skip to content

Environment Variables

Required

VariableDescription
SECRET_KEYRequired. JWT signing secret. Generate with openssl rand -hex 32.

Core

VariableDefaultDescription
WORKERS2Number of uvicorn worker processes. 2–4 is typical; more workers = more memory.
LIBRARY_PATH/app/libraryPath to the library directory inside the container.
DATA_PATH/app/dataPath for the database, thumbnails, and search cache inside the container.
BASE_URLhttp://localhost:9481Public base URL of this instance. Set to your external URL when running behind a reverse proxy; used for OPDS feed links and OIDC redirect URIs.
LOG_LEVELinfoConsole log verbosity: debug, info, warning, error, critical. The in-app Logs tab always captures debug-level entries regardless of this setting.
TZUTCTimezone for all log timestamps (console output and the in-app Logs tab). Use an IANA zone name such as America/Toronto or Europe/Berlin. Defaults to UTC when unset; an unknown zone name logs a warning and uses UTC.

Optional features

VariableDefaultDescription
VALKEY_URLnoneRedis-compatible cache URL for rendered page images (e.g. redis://valkey:6379/0). Falls back to disk cache when unset. Also shares auth rate-limit counters across replicas; see Security.
OPDS_ENABLEDfalseSet to true to enable the OPDS catalog.

Library scanning

VariableDescription
DISABLE_FOLDER_CATEGORY_INFERENCEtrue or false. When set, pins folder-name category inference on or off, overriding the in-app toggle (which is shown read-only). When true, books are not auto-assigned a category from their folder names and fall back to uncategorized. Leave unset to control it from Settings → Maintenance. To disable inference for a single game system only, drop an empty .no-auto-category file at that system's folder root.

OCR

Image-only PDFs (scanned books with no embedded text) can be run through the bundled Tesseract engine so their text is added to the search index. See Performance → OCR.

VariableDefaultDescription
OCR_ENABLEDtrueSet to false to disable OCR of image-only PDFs even on the OCR-capable image. Automatically off on -slim images (which omit Tesseract).
OCR_LANGUAGESeng+-joined Tesseract language codes, e.g. eng or eng+deu+fra. Extra languages require their .traineddata files to be present in the image's tessdata directory.
OCR_CONCURRENCY1Number of scanned books OCR'd in parallel by the background OCR worker. Raise on multi-core hosts with spare CPU/RAM; keep at 1 on small devices. Set to 0 to turn OCR off entirely (same effect as OCR_ENABLED=false) — a runtime off switch for hosts hitting repeated OCR errors or out-of-memory kills.
OCR_DPI150Resolution (clamped 72–600) scanned pages are rasterized at before OCR. Higher improves recognition on faint scans but is slower and uses more memory per page; lower is faster and lighter.

Authentication

VariableDescription
ALLOW_PASSWORD_AUTHENTICATIONtrue or false. Pins password authentication on or off, overriding the in-app toggle (which is shown read-only). First-run admin setup always requires a password regardless of this value.
GUEST_ACCESS_ENABLEDtrue or false. Pins guest invite codes on or off, overriding the in-app toggle (shown read-only). Off by default. See Guest Access.

Security

Per-IP rate limiting on the credential-checking endpoints, plus security headers. See Security for the full explanation.

VariableDefaultDescription
AUTH_RATE_LIMIT10/minutePer-IP throttle on /api/auth/login, /api/auth/setup, /api/auth/guest-login, and /api/stats. Exceeding it returns 429. Uses a limits string like 20/minute or 100/hour.
RATE_LIMIT_ENABLEDtrueSet to false to disable auth rate limiting entirely.
TRUST_FORWARDED_FORtrueWhen true, the limiter keys on the left-most X-Forwarded-For address so each client gets its own bucket behind a reverse proxy. Set to false only if Grimoire is exposed directly, so a spoofed header can't sidestep the limit.

OIDC

Each OIDC setting can be pinned via environment variable. Pinned values are shown read-only in Settings → Authentication.

VariableDescription
OIDC_ENABLEDMaster toggle for OIDC sign-in.
OIDC_ISSUER_URLBase URL of the IdP.
OIDC_TOKEN_ISSUERExact iss value in tokens. Leave blank to auto-detect.
OIDC_AUTHORIZATION_ENDPOINTAuthorization endpoint URL.
OIDC_TOKEN_ENDPOINTToken endpoint URL.
OIDC_USERINFO_ENDPOINTUserinfo endpoint URL.
OIDC_JWKS_URIJWKS URL for ID token signature validation.
OIDC_END_SESSION_ENDPOINTOptional RP-initiated logout endpoint.
OIDC_CLIENT_IDClient ID issued by the IdP.
OIDC_CLIENT_SECRETClient secret issued by the IdP.
OIDC_SIGNING_ALGOne of RS256/RS384/RS512/ES256/ES384/ES512/PS256/PS384/PS512/HS256. Default RS256.
OIDC_BUTTON_TEXTLabel for the SSO button on the login page.
OIDC_GROUPS_CLAIMName of the claim containing group memberships.
OIDC_PERMISSIONS_CLAIMName of the claim containing a permissions object.
OIDC_MATCH_BYnone, email, or username: how to link existing accounts on first OIDC login.
OIDC_AUTO_LAUNCHAutomatically redirect to the IdP when visiting /login.
OIDC_AUTO_REGISTERAutomatically create local accounts on first OIDC login.

Released under the GNU GPL v3.0 License.