(ctx context.Context, w io.Writer, serviceName, projectDir string)
| 29 | } |
| 30 | |
| 31 | func StartServices(ctx context.Context, w io.Writer, serviceName, projectDir string) error { |
| 32 | path := fmt.Sprintf("/process/start/%s", serviceName) |
| 33 | |
| 34 | body, status, err := clientRequest(path, http.MethodPost, projectDir) |
| 35 | if err != nil { |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | switch status { |
| 40 | case http.StatusOK: |
| 41 | fmt.Fprintf(w, "Service %s started.\n", serviceName) |
| 42 | return nil |
| 43 | default: |
| 44 | return fmt.Errorf("error starting service %s: %s", serviceName, body) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func StopServices(ctx context.Context, serviceName, projectDir string, w io.Writer) error { |
| 49 | path := fmt.Sprintf("/process/stop/%s", serviceName) |
no test coverage detected