Aller au contenu

Environment Variables

Ce contenu n’est pas encore disponible dans votre langue.

Audience: developer or operator configuring a Cortex instance.

All variables are read from the process environment at startup by cortex/config/env.ts. Variables marked required will cause a fatal error in production if missing. In development mode, missing required variables default to empty strings.


NameRequiredDefaultDescription
PORTno3000HTTP server port.
NODE_ENVnodevelopmentEnvironment: development, production, or test.
CORS_ORIGINno*Allowed CORS origins for the main API.
CORS_ORIGIN_PUBLICnoCORS_ORIGIN valueAllowed CORS origins for public routes.
CORTEX_API_KEYSprodComma-separated API keys for authentication. Required in production.
CORTEX_MODEnofullAPI mode: full (all routes) or lib (read-only catalogue).
HCM_DATA_DIRno.hcmLocal data directory for seed data and exports.

NameRequiredDefaultDescription
SURREAL_URLnows://localhost:8000/rpcSurrealDB WebSocket URL. Use http://surrealdb:8000 in Docker.
SURREAL_NSnohcmSurrealDB namespace.
SURREAL_DBnomainSurrealDB database name.
SURREAL_USERprodSurrealDB root username. Required in production.
SURREAL_PASSprodSurrealDB root password. Required in production.

NameRequiredDefaultDescription
PG_HOSTnolocalhostPostgreSQL host. Use postgres in Docker.
PG_PORTno5432PostgreSQL port.
PG_DATABASEnohcmPostgreSQL database name.
PG_USERprodPostgreSQL username. Required in production.
PG_PASSWORDprodPostgreSQL password. Required in production.

NameRequiredDefaultDescription
MEILI_URLnohttp://localhost:7700MeiliSearch URL. Use http://meilisearch:7700 in Docker.
MEILI_MASTER_KEYprodMeiliSearch master key. Required in production.

NameRequiredDefaultDescription
S3_ENDPOINTnohttp://localhost:9000S3-compatible endpoint. Use http://minio:9000 in Docker.
S3_ACCESS_KEY_IDprodS3 access key ID. Required in production.
S3_SECRET_ACCESS_KEYprodS3 secret access key. Required in production.
S3_BUCKETnohcm-filesS3 bucket name.

NameRequiredDefaultDescription
OLLAMA_URLnohttp://localhost:11434Ollama server URL. Use http://ollama:11434 in Docker.
OLLAMA_MODELnobge-m3Embedding model name (1024 dimensions).
OLLAMA_LLM_MODELnomistralLLM model name for enrichment tasks.
OLLAMA_TIMEOUTno30000Ollama request timeout in milliseconds. Must be >= 1000.
RESONANCE_THRESHOLDno0.3Minimum score for resonance edges. Range: 0.0 to 1.0.

NameRequiredDefaultDescription
INGESTION_EMBEDDING_TIMEOUT_MSno10000Timeout per embedding request during ingestion. Must be >= 1000.
INGESTION_EMBEDDING_MAX_INPUT_CHARSno8000Maximum input length for embedding. Must be >= 100.
INGESTION_EMBEDDING_RETRY_MAXno3Maximum embedding retry attempts. Must be >= 1.
INGESTION_BATCH_MAX_BLOCSno200Maximum blocs per batch ingestion request. Must be >= 1.

NameRequiredDefaultDescription
ENCRYPTION_KEYprodAES-256-GCM encryption key (32 bytes, base64-encoded). Used for provider credentials. Required in production.

NameRequiredDefaultDescription
INSTANCE_IDnodefaultUnique instance identifier for snapshot comparison.
INSTANCE_LABELnoHCM InstanceHuman-readable instance label.
HCM_VERSIONno3.3.0Cortex version tag included in snapshots.
SOUCHE_VERSIONno3.3.0-baseSouche (baseline) version tag.

The MCP server reads the same environment variables as the API server, plus:

NameRequiredDefaultDescription
MCP_TRANSPORTnohttpTransport type: http (StreamableHTTP) or stdio.
MCP_PORTno3001MCP server port (when transport is http).
MCP_VARIANTnomainTool variant: main, claude-code, cloud, praxis, or public.

These variables are used in docker-compose.example.yml to override default host-side ports:

NameDefaultService
SURREAL_PORT8000SurrealDB
PG_PORT5432PostgreSQL
MEILI_PORT7700MeiliSearch
S3_PORT9000MinIO API
S3_CONSOLE_PORT9001MinIO console
OLLAMA_PORT11434Ollama
API_PORT9096Cortex API
MCP_PORT3001Cortex MCP
UI_PORT8080Cortex UI

In production (NODE_ENV=production), the following variables are required and validated at startup:

  • SURREAL_PASS
  • PG_PASSWORD
  • MEILI_MASTER_KEY
  • S3_SECRET_ACCESS_KEY
  • CORTEX_API_KEYS
  • ENCRYPTION_KEY

The application will exit with an error if any of these are missing or empty.

Additional numeric validations:

  • PORT: 1-65535
  • PG_PORT: 1-65535
  • OLLAMA_TIMEOUT: >= 1000
  • RESONANCE_THRESHOLD: 0.0-1.0
  • INGESTION_EMBEDDING_TIMEOUT_MS: >= 1000
  • INGESTION_EMBEDDING_MAX_INPUT_CHARS: >= 100
  • INGESTION_EMBEDDING_RETRY_MAX: >= 1
  • INGESTION_BATCH_MAX_BLOCS: >= 1