[supervisord]
nodaemon=true
; No user= here: container already runs as 'node' (USER node in Dockerfile).
; Setting user=root when running as non-root causes "Can't drop privilege" error.
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/tmp/supervisord.pid

; All env vars (OPENCLAW_GATEWAY_TOKEN, CLAUDE_API_KEY, IT0_INSTANCE_ID,
; IT0_AGENT_SERVICE_URL, DINGTALK_CLIENT_ID, DINGTALK_CLIENT_SECRET, etc.)
; are passed via "docker run -e". Child processes inherit them from supervisord's
; own environment — no need for per-program environment= directives, which would
; cause "cannot be expanded" errors for any var that is absent or optional.

; OpenClaw gateway process
[program:openclaw]
command=node /app/openclaw/dist/index.js gateway --port 18789 --allow-unconfigured
directory=/app/openclaw
autostart=true
autorestart=true
startretries=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; IT0 Bridge process
[program:it0-bridge]
command=node /app/bridge/dist/index.js
directory=/app/bridge
autostart=true
autorestart=true
startretries=10
startsecs=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

; DingTalk Channel — stays running only if DINGTALK_CLIENT_ID is set.
; start-dingtalk.sh exits 0 when unconfigured → supervisord leaves it EXITED, no restart loop.
[program:dingtalk-channel]
command=/app/bridge/start-dingtalk.sh
directory=/app/bridge
autostart=true
autorestart=unexpected
exitcodes=0
startretries=5
startsecs=10
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
