Skip to main content

Configuration

VCAL Semantic Cache is configured through environment variables or an optional .env file. If a variable is not set, the documented default is used.

For production deployments, prefer a .env file, systemd environment overrides, Docker secrets, or mounted key files over inline secrets.


Core / Index

VariableDescriptionDefault
VCAL_BINDAddress and port to bind the HTTP server0.0.0.0:8080
VCAL_DIMSVector dimensionality. Required when no snapshot exists.
VCAL_MHNSW graph out-degree32
VCAL_EF_SEARCHHNSW search parameter128
VCAL_SIM_THRESHOLDGlobal similarity cutoff used by search/QA when a request does not override it0.80
VCAL_DATA_DIRPersistent data directory for index, answers, and tombstones./data

Capacity & Eviction

VariableDescriptionDefault
VCAL_CAP_MAX_BYTESMax cache size before LRU eviction. Use values appropriate for the container memory limit.
VCAL_CAP_MAX_VECTORSMax vector count before LRU eviction
VCAL_TTL_SECSDefault TTL for cache entries, in seconds
VCAL_EVICT_EVERY_SECSInterval between eviction sweeps30

If both byte and vector limits are set, eviction can trigger when either limit is reached. For Docker deployments with small memory limits, VCAL_CAP_MAX_VECTORS is often safer and easier to reason about than a large byte cap.


Persistence / Snapshots

VariableDescriptionDefault
VCAL_AUTOSAVE_SECSAutosave interval for paired snapshots. 0 disables autosave.300
VCAL_AUTOSAVE_ATOMICWrite snapshots atomically using temporary files and rename1

VCAL Semantic Cache v0.6.0 persists the paired snapshot set:

vcal.index
answers.json
tombstones.json

Runtime autosave and manual /v1/snapshot/save are background-safe:

capture consistent in-memory bundle under read lock
release read lock
write files without entering drain mode

Graceful shutdown still uses the quiescent save path:

enter drain mode
wait for in-flight requests
save final paired snapshot
exit

Snapshots are compatible within the supported release family, but old pre-envelope snapshots may need to be archived or migrated before startup.


Authentication & Authorization

VariableDescriptionDefault
VCAL_AUTH_REQUIREDRequire API keys for protected endpoints0
VCAL_AUTH_HEADERHTTP header used for API keysx-vcal-key
VCAL_KEYS_APPComma-separated app keys for data-plane endpoints
VCAL_KEY_APPLegacy single app key variable
VCAL_KEYS_ADMINComma-separated admin keys for management endpoints
VCAL_KEYS_APP_FILEFile containing app keys, one per line
VCAL_KEYS_ADMIN_FILEFile containing admin keys, one per line
VCAL_ALLOW_METRICS_WITHOUT_AUTHAllow /metrics without authentication0

Protected endpoint behavior when authentication is enabled:

  • /healthz remains public.
  • /readyz requires a valid app or admin key.
  • Data-plane routes such as /v1/search, /v1/qa, /v1/insert, /v1/upsert, and /v1/delete require an app or admin key.
  • Management routes such as /v1/snapshot/save and /v1/license/status require an admin key.

Licensing Required

VCAL Semantic Cache will not start without a valid license.

VariableDescriptionDefault
VCAL_LICENSE_JSONInline signed license JSON
VCAL_LICENSE_PATHPath to signed license JSON file/etc/vcal/license.json
VCAL_LICENSE_FILEAlternate path to signed license JSON file
VCAL_DOCKER_LICENSE_PATHDocker-specific license path override
VCAL_LICENSE_PUBKEY_FILEOptional Ed25519 public key overridebundled/default

Avoid setting multiple license path variables to different files. If both VCAL_LICENSE_PATH and VCAL_LICENSE_FILE are set, make sure they point to the same license or remove the unused variable.


Limits / Middleware

VariableDescriptionDefault
VCAL_RATE_QPSGlobal request rate limit. 0 disables it.0
VCAL_RATE_WINDOW_SECSRate-limit window size1
VCAL_TIMEOUT_SECSPer-request timeout in seconds30
VCAL_CONCURRENCYMax concurrent requests. 0 means unlimited.0

Metrics / Observability

VariableDescriptionDefault
VCAL_PROM_ENABLEDEnable Prometheus /metrics endpoint1
VCAL_TOKENS_PER_HITEstimated tokens saved per cache hit0
RUST_LOGRuntime log level used by tracing/logginginfo
RUST_BACKTRACEBacktrace mode for diagnostics

Example .env

VCAL_BIND=0.0.0.0:8080
VCAL_DIMS=768
VCAL_M=32
VCAL_EF_SEARCH=128
VCAL_SIM_THRESHOLD=0.80
VCAL_DATA_DIR=/var/lib/vcal/data

VCAL_CAP_MAX_VECTORS=50000
VCAL_TTL_SECS=2592000
VCAL_EVICT_EVERY_SECS=60

VCAL_AUTOSAVE_SECS=3600
VCAL_AUTOSAVE_ATOMIC=1

VCAL_AUTH_REQUIRED=1
VCAL_AUTH_HEADER=x-vcal-key
VCAL_KEYS_APP_FILE=/opt/vcal-server/app.keys
VCAL_KEYS_ADMIN_FILE=/opt/vcal-server/admin.keys
VCAL_ALLOW_METRICS_WITHOUT_AUTH=1

VCAL_LICENSE_PATH=/etc/vcal/license.json
VCAL_LICENSE_PUBKEY_FILE=/etc/vcal/ed25519.pk.b64

RUST_LOG=info
RUST_BACKTRACE=full

Notes

  • All key and license files must be readable by the VCAL Semantic Cache process.
  • For Docker, remember that paths in environment variables are container paths, not host paths.
  • For production deployments, avoid committing secrets, API keys, license files, or private signing keys into source control.