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

Function setEnabled

apps/desktop/main/api/index.ts:139–156  ·  view source on GitHub ↗
(enabled: boolean)

Source from the content-addressed store, hash-verified

137 * Set enabled state (persisted)
138 */
139export async function setEnabled(enabled: boolean): Promise<ApiServerStatus> {
140 const config = cm().load()
141 config.enabled = enabled
142 cm().save(config)
143
144 if (enabled) {
145 cm().ensureToken(config)
146 try {
147 await start()
148 } catch {
149 // lastError already recorded
150 }
151 } else {
152 await stop()
153 }
154
155 return getStatus()
156}
157
158/**
159 * Set port (persisted, requires server restart)

Callers

nothing calls this directly

Calls 7

cmFunction · 0.85
startFunction · 0.85
stopFunction · 0.85
getStatusFunction · 0.85
ensureTokenMethod · 0.80
loadMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected