Skip to content

Configuration and Environment Variables ​

This document defines all configuration variables and parameters for ContextCortex.

Environment Variables Reference ​

Configure the application by setting these environment variables in your system environment or a .env file.

Variable NameDescriptionDefault ValueExample
DATABASE_URLSQLAlchemy connection string for relational data.sqlite:////app/data/index_cache.dbpostgresql+psycopg://user:pass@postgres:5432/contextcortex
VECTOR_STORE_PROVIDERActive vector search engine (qdrant, pgvector, or chroma).qdrantqdrant
QDRANT_HOSTHostname or IP address of remote Qdrant service.qdrant10.0.0.10
QDRANT_PORTHTTP API port for Qdrant service.63336333
QDRANT_GRPC_PORTHigh-performance gRPC port for Qdrant service.63346334
COLLECTION_NAMEName of the primary vector collection in vector store.knowledge_rag_v1knowledge_rag_v1
EMBEDDING_PROVIDEREmbedding generation provider (local or api).locallocal
EMBEDDING_MODELHugging Face model identifier for dense embeddings.BAAI/bge-small-en-v1.5BAAI/bge-small-en-v1.5
SPARSE_MODELModel used for lexical sparse keyword vector generation.Qdrant/bm25Qdrant/bm25
EMBEDDING_NUM_THREADSMaximum CPU worker threads allocated for ONNX runtime.min(2, system_cpus)4
EMBEDDING_BATCH_SIZEMaximum batch size processed during vector tokenization.3264
LOCAL_STORAGE_PATHHost path for managed file and document uploads./app/data/storage/drives/storage
AUTH_ENABLEDEnables MCP OAuth 2.1 authentication and API key validation.falsetrue
AUTH_OIDC_ISSUEROpenID Connect Identity Provider issuer URL.Nonehttps://auth.company.com/realms/master
AUTH_JWKS_URICustom JSON Web Key Set URL override for token verification.Nonehttps://auth.company.com/realms/master/protocol/openid-connect/certs
AUTH_RESOURCE_INDICATORRFC 8707 / RFC 9728 Resource Indicator for ContextCortex.https://contextcortex.localhttps://contextcortex.wileyriley.com
ADMIN_INITIAL_KEYBootstrap API key seeded during container initialization.Nonecc_admin_initial_secret
GITHUB_TOKENGlobal GitHub personal access token for higher API limits.Noneghp_xxxxxxxxxxxx
GITLAB_TOKENGlobal GitLab personal access token.Noneglpat-xxxxxxxxxxxx
GITEA_TOKENGlobal Gitea or Forgejo access token.Nonexxxxxxxxxxxxxxxx
AUTO_SYNC_INTERVALDefault polling interval in minutes for tracked repositories.6030

Database Profile Selection ​

ContextCortex supports two primary database profiles:

1. SQLite Profile (Default Development Mode) ​

  • Zero Configuration: Requires no external database container.
  • Write-Ahead Logging (WAL): Automatically enabled for concurrent read and write operations.
  • Connection Timeout: Set to 5000 milliseconds to avoid disk lock errors.
  • Relational Cache: Stored on disk at /app/data/index_cache.db.

2. PostgreSQL 16 + pgvector Profile (Production Mode) ​

  • Enterprise Concurrency: Full ACID transaction support across multiple worker threads.
  • Native Vector Indexing: Creates vector(384) columns with HNSW cosine distance indexing (vector_cosine_ops).
  • Connection Pooling: Uses psycopg3 pooled connections with automatic retry loops.
  • Configuration:
    bash
    export DATABASE_URL="postgresql+psycopg://contextcortex:cortexsecret@postgres:5432/contextcortex"
    export VECTOR_STORE_PROVIDER="pgvector"

Vector Store Configuration ​

Qdrant Mode ​

ContextCortex connects to Qdrant for dense and sparse BM25 hybrid search.

  • When QDRANT_HOST is specified, the system connects to the remote Qdrant service.
  • If no remote service is found, the system operates in local embedded disk mode at /app/data/qdrant_storage.

ChromaDB Mode ​

ChromaDB provides lightweight embedded vector storage without external services:

bash
export VECTOR_STORE_PROVIDER="chroma"

LiteLLM Proxy Integration ​

To use dynamic model discovery with a LiteLLM proxy:

  1. Configure these environment variables:

    bash
    export EMBEDDING_PROVIDER="api"
    export LITELLM_URL="http://litellm:4000/v1"
    export LITELLM_API_KEY="sk-your-litellm-key"
  2. Open the Settings tab in the Web Dashboard.

  3. The dashboard queries the LiteLLM proxy models endpoint.

  4. Select your preferred embedding model, vision OCR model, and chat model.

Released under the MIT License.