Skip to content

Commit

Permalink
Fix hook signature for function hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
biilmann authored and brycekahle committed Jun 6, 2018
1 parent f334c8b commit 299d46a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/hooks.go
Expand Up @@ -154,6 +154,7 @@ func closeBody(rsp *http.Response) {


func triggerHook(ctx context.Context, conn *storage.Connection, event HookEvent, user *models.User, instanceID uuid.UUID, config *conf.Configuration) error { func triggerHook(ctx context.Context, conn *storage.Connection, event HookEvent, user *models.User, instanceID uuid.UUID, config *conf.Configuration) error {
var hookURL *url.URL var hookURL *url.URL
secret := config.Webhook.Secret
if config.Webhook.URL != "" { if config.Webhook.URL != "" {
var err error var err error
hookURL, err = url.Parse(config.Webhook.URL) hookURL, err = url.Parse(config.Webhook.URL)
Expand All @@ -174,6 +175,7 @@ func triggerHook(ctx context.Context, conn *storage.Connection, event HookEvent,
if err != nil { if err != nil {
return errors.Wrapf(err, "Failed to parse Event Function Hook URL") return errors.Wrapf(err, "Failed to parse Event Function Hook URL")
} }
secret = config.JWT.Secret
} else { } else {
// abort hook call if there are no functions for this event // abort hook call if there are no functions for this event
return nil return nil
Expand Down Expand Up @@ -220,7 +222,7 @@ func triggerHook(ctx context.Context, conn *storage.Connection, event HookEvent,


w := Webhook{ w := Webhook{
WebhookConfig: &config.Webhook, WebhookConfig: &config.Webhook,
jwtSecret: config.Webhook.Secret, jwtSecret: secret,
instanceID: instanceID, instanceID: instanceID,
claims: claims, claims: claims,
payload: data, payload: data,
Expand Down

0 comments on commit 299d46a

Please sign in to comment.