MCPcopy
hub / github.com/opencloud-eu/opencloud / StartOpencloudHandler

Function StartOpencloudHandler

tests/ocwrapper/wrapper/handlers/handler.go:142–163  ·  view source on GitHub ↗
(res http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

140}
141
142func StartOpencloudHandler(res http.ResponseWriter, req *http.Request) {
143 if req.Method != http.MethodPost {
144 sendResponse(res, http.StatusMethodNotAllowed, "")
145 return
146 }
147
148 if opencloud.IsOpencloudRunning() {
149 sendResponse(res, http.StatusConflict, "opencloud server is already running")
150 return
151 }
152
153 common.Wg.Add(1)
154 go opencloud.Start(nil)
155
156 success, message := opencloud.WaitForConnection()
157 if success {
158 sendResponse(res, http.StatusOK, message)
159 return
160 }
161
162 sendResponse(res, http.StatusInternalServerError, message)
163}
164
165func CommandHandler(res http.ResponseWriter, req *http.Request) {
166 if req.Method != http.MethodPost {

Callers

nothing calls this directly

Calls 3

sendResponseFunction · 0.85
AddMethod · 0.65
StartMethod · 0.45

Tested by

no test coverage detected