LensHub/ docs / environment variables
Reference

Environment variables

Every setting the API, worker and embedders read.

Self-hosted only — on the managed service these are set for you. Organization settings in the interface override the model-related ones.

VariableWhat it does
API_PORTOptionalPort to listen on. Defaults to 8080
APPD_TLS_CAOptionalCA certificate that signed appd's certificate, for an https APPD_URL. Unset uses the system roots
APPD_TLS_CLIENT_CERTOptionalThe API's client certificate, for an appd that requires mutual TLS. Set together with APPD_TLS_CLIENT_KEY
APPD_TLS_CLIENT_KEYOptionalPrivate key for APPD_TLS_CLIENT_CERT
APPD_TOKENOptionalBearer token shared with appd. 32+ hex characters, openssl rand -hex 32
APPD_URLOptionalThe apps node (appd) address, e.g. http://appd:9090. Apps are off unless both APPD_ variables are set
APPS_SOURCE_DIROptionalWhere each app release's source is kept, for merge deploys and reading files back. Default: app-sources on the uploads volume when it is mounted
BASE_URLImportantYour public address. Agent sign-in breaks if wrong
CODE_EMBED_BASE_URLOptionalEndpoint for the code search lane
CODE_EMBED_MODELOptionalModel for the code search lane
COOKIE_DOMAINOptionalCookie domain, if you need it set explicitly
COOKIE_SECUREImportanttrue when serving over HTTPS
DATABASE_URLRequiredPostgreSQL connection string
ENCRYPTION_KEYRequiredEncrypts connector credentials. Exactly 32 bytes, base64
JWT_SECRETRequiredSigns sessions. 32+ characters
LENSHUB_ENVOptionalproduction enables stricter startup checks
LLM_API_KEYOptionalKey for your provider
LLM_BASE_URLOptionalAPI root. Empty for OpenAI itself
LLM_CHAT_MODELOptionalChat model name
LLM_EMBED_BASE_URLOptionalEmbedding endpoint. Keep local to avoid sending content out
LLM_EMBED_MODELOptionalEmbedding model. Empty keeps the bundled local one
LLM_PROVIDEROptionalopenai for anything OpenAI-compatible, or vllm
METRICS_LISTENOptionalAddress for the internal Prometheus /metrics listener, e.g. :9464. Unset or empty turns it off. Never publish it
OPENAI_API_KEYOptionalFallback if LLM_API_KEY is unset
RERANK_DEFAULTOptionalRerank without being asked
RERANK_OVERSAMPLEOptionalCandidates considered before reranking
RERANK_URLOptionalResult reranking service, if you run one

Worker

The worker reads DATABASE_URL, ENCRYPTION_KEY, the LLM_* group and EMBEDDING_DIM like the API, plus:

VariableDefaultWhat it does
WORKER_CONCURRENCY8 in compose (4 without)Jobs run in parallel
WORKER_METRICS_LISTEN:9465 in composeInternal Prometheus /metrics listener. Empty turns it off
CODE_EMBED_BASE_URL, CODE_EMBED_MODEL, CODE_EMBEDDING_DIMbundled embedding-codeThe code lane's embedder
EMBED_CODE_MAX_ATTEMPTS3Tries a code file gets before it is marked failed and skipped until it changes
RETENTION_JOBS_DONE_DAYS14Finished and cancelled jobs are deleted after this many days
RETENTION_JOBS_FAILED_DAYS90Failed jobs
RETENTION_RETRIEVAL_LOGS_DAYS365Search logs
RETENTION_TOOL_CALLS_DAYS365MCP and chat tool-call records
RETENTION_AGENT_SESSIONS_DAYS365Agent sessions
RETENTION_AUDIT_LOG_DAYS365Audit log
RETENTION_AUTH_EVENTS_DAYS365Authentication trail
RETENTION_APP_UPLOAD_LINKS_DAYS7Spent and expired app source upload links

Every RETENTION_* value of 0 keeps that table forever.

Embedding servers

VariableDefaultWhat it does
EMBED_BULK_SLICEone encode batchBulk requests are encoded in slices this size, so a search waits for at most one slice

Apps runtime

appd's settings (APPD_BUILD_NETWORK, APPD_BUILD_ALLOW, APPD_DENY_CIDRS, APPD_TLS_*, APPD_METRICS_LISTEN, storage and resource limits) are listed in .env.example and services/appd/apps-node/.env.example.

See Configuration for which ones actually matter and when.

On this page