(ctx context.Context, serviceName, projectDir string, w io.Writer)
| 46 | } |
| 47 | |
| 48 | func StopServices(ctx context.Context, serviceName, projectDir string, w io.Writer) error { |
| 49 | path := fmt.Sprintf("/process/stop/%s", serviceName) |
| 50 | |
| 51 | body, status, err := clientRequest(path, http.MethodPatch, projectDir) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | |
| 56 | switch status { |
| 57 | case http.StatusOK: |
| 58 | fmt.Fprintf(w, "Service %s stopped.\n", serviceName) |
| 59 | return nil |
| 60 | default: |
| 61 | return fmt.Errorf("error stopping service %s: %s", serviceName, body) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func RestartServices(ctx context.Context, serviceName, projectDir string, w io.Writer) error { |
| 66 | path := fmt.Sprintf("/process/restart/%s", serviceName) |
no test coverage detected