@@ -213,27 +213,31 @@ func OcisServiceHandler(res http.ResponseWriter, req *http.Request) {
213
213
serviceName := strings .TrimPrefix (req .URL .Path , "/services/" )
214
214
215
215
if serviceName == "" {
216
- sendResponse (res , http .StatusUnprocessableEntity , "Service name is required " )
216
+ sendResponse (res , http .StatusUnprocessableEntity , "Service name not specified " )
217
217
return
218
218
}
219
+
219
220
envVar := fmt .Sprintf ("OCIS_EXCLUDE_RUN_SERVICES=%s" , serviceName )
220
221
ocis .EnvConfigs = append (ocis .EnvConfigs , envVar )
221
222
222
223
if req .Method == http .MethodPost {
223
224
success , _ := ocis .Restart (ocis .EnvConfigs )
224
225
if success {
225
- sendResponse (res , http .StatusOK , "oCIS configured successfully" )
226
- ocis .RunOcisService (serviceName )
226
+ sendResponse (res , http .StatusOK , fmt .Sprintf ("oCIS restarted successfully without service %s" , serviceName ))
227
+
228
+ go ocis .RunOcisService (serviceName )
229
+
230
+ sendResponse (res , http .StatusOK , fmt .Sprintf ("oCIS service %s started successfully" , serviceName ))
227
231
return
228
232
}
229
- sendResponse (res , http .StatusInternalServerError , "Failed to restart oCIS with new configuration" )
233
+
234
+ sendResponse (res , http .StatusInternalServerError , fmt .Sprintf ("Failed to restart oCIS without service %s" , serviceName ))
230
235
}
231
236
232
237
if req .Method == http .MethodDelete {
233
- // Attempt to stop the service
234
238
success , message := ocis .StopService (serviceName )
235
239
if success {
236
- sendResponse (res , http .StatusOK , fmt .Sprintf ("Service %s stopped successfully" , serviceName ))
240
+ sendResponse (res , http .StatusOK , fmt .Sprintf ("oCIS service %s stopped successfully" , serviceName ))
237
241
} else {
238
242
sendResponse (res , http .StatusInternalServerError , message )
239
243
}
0 commit comments