Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit 754625b

Browse files
committed
[hooks] add back base url functionality
add ability to pass base url to during hooks registartion
1 parent b0bc76b commit 754625b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

webhooks/hooks.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,20 @@ func (h *Hooks) appendHookOperation(
127127
if err := h.checkTriggerName(hookOp.Trigger.TriggerName); err != nil {
128128
return false, nil, err
129129
}
130+
if hookOp.Trigger.URL != "" && h.baseWebhookURL != nil {
131+
u, err := url.Parse(hookOp.Trigger.URL)
132+
if err == nil {
133+
hookOp.Trigger.URL = h.baseWebhookURL.ResolveReference(u).String()
134+
}
135+
}
136+
} else {
137+
if hookOp.Function.URL != "" && h.baseWebhookURL != nil {
138+
u, err := url.Parse(hookOp.Function.URL)
139+
if err == nil {
140+
hookOp.Function.URL = h.baseWebhookURL.ResolveReference(u).String()
141+
}
142+
}
130143
}
131-
132144
hooksOps = append(hooksOps, hookOp)
133145
return true, hooksOps, nil
134146
}

0 commit comments

Comments
 (0)