diff options
| -rw-r--r-- | main.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -19,6 +19,7 @@ type cynciWebhookPayload struct { } type configJSON struct { + WorkDir string `json:"workdir"` Handlers map[string]string `json:"handlers"` WebhookTokens map[string]string `json:"webhook_tokens"` // map[token_name]token_value } @@ -57,6 +58,8 @@ func executeHandler(repoName string) error { return errors.New("no handler found") } + handler = filepath.Join(*dataPath, handler) + args := []string{handler} dt := time.Now().UTC().Format("2006-01-02_15-04-05.999") @@ -73,6 +76,11 @@ func executeHandler(repoName string) error { cmd.Stdout = logFile cmd.Stderr = logFile cmd.Dir = *dataPath + + if config.WorkDir != "" { + cmd.Dir = config.WorkDir + } + err = cmd.Run() if err != nil { return fmt.Errorf("failed to execute handler: %v", err) |
