MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / buildUnit

Function buildUnit

apps/cli/src/daemon/service.ts:191–215  ·  view source on GitHub ↗
(options: ServiceInstallOptions)

Source from the content-addressed store, hash-verified

189}
190
191function buildUnit(options: ServiceInstallOptions): string {
192 const port = options.port ?? 3110
193 const host = options.host ?? '127.0.0.1'
194 const cliEntry = resolveCliPath('bin/chatlab.mjs')
195 const args = ['start', '--no-open', '--port', String(port), '--host', host]
196 if (options.token) args.push('--token', options.token)
197 if (options.headless) args.push('--headless')
198 if (options.requireAuth) args.push('--require-auth')
199 const execStart = [process.execPath, cliEntry, ...args].map(escapeSystemdArg).join(' ')
200
201 return `[Unit]
202Description=ChatLab daemon
203After=network.target
204
205[Service]
206ExecStart=${execStart}
207Restart=always
208RestartSec=5
209StandardOutput=append:${LOG_FILE}
210StandardError=append:${LOG_FILE}
211
212[Install]
213WantedBy=default.target
214`
215}
216
217function installLinux(options: ServiceInstallOptions): void {
218 fs.mkdirSync(SYSTEMD_DIR, { recursive: true })

Callers 1

installLinuxFunction · 0.85

Calls 1

resolveCliPathFunction · 0.90

Tested by

no test coverage detected