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

Function setPort

apps/desktop/main/api/index.ts:161–178  ·  view source on GitHub ↗
(port: number)

Source from the content-addressed store, hash-verified

159 * Set port (persisted, requires server restart)
160 */
161export async function setPort(port: number): Promise<ApiServerStatus> {
162 const config = cm().load()
163 const wasRunning = server !== null
164
165 config.port = port
166 cm().save(config)
167
168 if (wasRunning) {
169 await stop()
170 try {
171 await start()
172 } catch {
173 // lastError already recorded
174 }
175 }
176
177 return getStatus()
178}
179
180export function getConfig(): ApiServerConfig {
181 return cm().load()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected