MCPcopy
hub / github.com/louislam/dockge / statusConvert

Method statusConvert

backend/stack.ts:363–375  ·  view source on GitHub ↗

* Convert the status string from `docker compose ls` to the status number * Input Example: "exited(1), running(1)" * @param status

(status : string)

Source from the content-addressed store, hash-verified

361 * @param status
362 */
363 static statusConvert(status : string) : number {
364 if (status.startsWith("created")) {
365 return CREATED_STACK;
366 } else if (status.includes("exited")) {
367 // If one of the service is exited, we consider the stack is exited
368 return EXITED;
369 } else if (status.startsWith("running")) {
370 // If there is no exited services, there should be only running services
371 return RUNNING;
372 } else {
373 return UNKNOWN;
374 }
375 }
376
377 static async getStack(server: DockgeServer, stackName: string, skipFSOperations = false) : Promise<Stack> {
378 let dir = path.join(server.stacksDir, stackName);

Callers 2

getStackListMethod · 0.95
getStatusListMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected