Skip to main content

Configuration

info

For detailed security recommendations (HTTPS, etc.), see the Deployment page.

All configuration for the Base Worker is managed through the .env file. The file src/config/index.ts loads these variables and makes them available in your code.

Environment Variables

Below are the main environment variables used by the Base Worker.

VariableDescriptionDefault
AUTH_KEYAuthentication key required to access the Worker endpoints (except /health public info).default-auth-key
LB_AUTH_KEYKey used to validate requests coming from the Load Balancer. Change only if you use it.default-lb-auth-key
PORTHTTP port for the Worker API.3000
WEBSOCKET_PORTPort for the WebSocket server (for real-time slot updates with the Load Balancer ; change only if you use it).3001
GROUPThe group this Worker belongs to (used for routing and contract versioning).default
CONTRACTThe contract version implemented by this Worker.1
SLOTSNumber of parallel tasks the Worker can handle.10
DEFAULT_TIMEOUTDefault timeout (ms) for task execution.30000
LOG_LEVELLog verbosity (info, warn, error, etc.).info
MAX_LOGSNumber of log lines to keep in memory (for /logs).1000
WEBHOOK_TIMEOUTTimeout (ms) for webhook calls.5000
WEBHOOK_MAX_RETRIESNumber of times to retry a failed webhook.3
WEBHOOK_RETRY_DELAYDelay (ms) between webhook retries.1000
WEBHOOK_HEADERSJSON object of headers to send with webhook requests.{}
OPENAPI_ENABLEDEnable OpenAPI documentation endpoints (/docs and /openapi).true

Usage

  • All configuration is loaded at startup and available via the config object in src/config/index.ts.
  • These variables control authentication, routing, logging, slot management, and advanced features.

Example .env

AUTH_KEY=default-auth-key
LB_AUTH_KEY=default-lb-auth-key
PORT=3000
WEBSOCKET_PORT=3001
GROUP=default
CONTRACT=1
SLOTS=10
DEFAULT_TIMEOUT=30000
LOG_LEVEL=info
MAX_LOGS=1000
WEBHOOK_TIMEOUT=5000
WEBHOOK_MAX_RETRIES=3
WEBHOOK_RETRY_DELAY=1000
WEBHOOK_HEADERS={}
OPENAPI_ENABLED=true