Skip to main content

Configuration

Everything is set by environment variables, usually in .env at the repository root. .env.example lists them with their defaults.

API​

VariableDefaultWhat it does
NODE_ENVdevelopmentproduction ignores the X-User header. See Users and sign-in
HOST, PORT127.0.0.1, 3333Where the API listens. Keep it on loopback behind the proxy
CORS_ORIGINhttp://localhost:3000Browser origins allowed to call the API, comma separated. Not needed when the proxy serves both under one address
PUBLIC_API_URLhttp://127.0.0.1:3333/api/v1Where ClassCAD engines reach the API to fetch the parts of an assembly
DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAMElocalhost, 5002, pdm, pdm, pdmThe Postgres database
STORAGE_PROVIDERfsWhere files go. Only fs for now
STORAGE_DIR./storageThe file store, relative to where the API runs
DEV_USERlocal-developerWho a request is when it says nothing
ADMIN_USERSLogins with administrator rights, comma separated
LEASE_TTL_MINUTES30How long a reservation lasts without being renewed
JOB_HEARTBEAT_TIMEOUT_S120A running job whose worker is quiet this long goes back to the queue
JOB_MAX_ATTEMPTS3How often a job is tried
JOB_REAPER_INTERVAL_S30How often the API looks for such jobs
CODE_ALLOW_LOCAL_REPOSfalseLets code documents point at git repositories on the worker's disk. Development only

Job workers​

VariableDefaultWhat it does
PDM_API_URLhttp://127.0.0.1:3333/api/v1The API
CC_URLhttp://127.0.0.1:9094/apiClassCAD. Point it at the scheduler: http://127.0.0.1:9091/api
WORKER_ID<host>:<pid>The worker's name in jobs and logs
WORKER_USERclasscad-workerWho the worker is towards the API
CLASSCAD_RENDERER_DIRThe ClassCAD renderer, for pictures. Without it, no pictures
RUN_TIMEOUT_S300A generator run that takes longer is stopped
WORKER_ENVIRONMENTbaseWhich jobs this worker takes, by the classes its ClassCAD has loaded
GENERATOR_SDK_DIRpackages/generator-sdkThe generator SDK bundled into every run
POLL_INTERVAL_MS, HEARTBEAT_MS2000, 10000How often the worker asks for work, and reports on it

Use 127.0.0.1, not localhost, in ClassCAD addresses. ClassCAD listens on IPv4 only, and Node tries ::1 first for localhost.

Web app, at build time​

VariableDefaultWhat it does
VITE_API_URL/api/v1Where the browser finds the API
EDITOR_RUNTIMEwasmWhere ClassCAD runs for the editor: wasm in the browser, drogon on the server
CLASSCAD_WASM_KEYThe WebAssembly key, for wasm
CLASSCAD_WASM_URLClassCAD's CDNWhere the browser loads ClassCAD's WebAssembly from, if you host it yourself
EDITOR_CC_URLws://127.0.0.1:9094The WebSocket for drogon: the scheduler, through your proxy

These end up in the built files. Change them, build again.