mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-23 22:02:28 +00:00
added support for x-hub-signature
This commit is contained in:
parent
450852e1be
commit
3c4c025233
2 changed files with 22 additions and 17 deletions
|
@ -45,6 +45,10 @@ func (h *Hook) UnmarshalJSON(j []byte) error {
|
|||
h.Cwd = v.(string)
|
||||
}
|
||||
|
||||
if v, ok := m["secret"]; ok {
|
||||
h.Secret = v.(string)
|
||||
}
|
||||
|
||||
if v, ok := m["trigger-rule"]; ok {
|
||||
rule := v.(map[string]interface{})
|
||||
|
||||
|
@ -126,7 +130,7 @@ func New(hookFile string) (*Hooks, error) {
|
|||
func (h *Hooks) Match(id string, params interface{}) *Hook {
|
||||
for i := range h.list {
|
||||
if h.list[i].ID == id {
|
||||
if h.list[i].Rule != nil && h.list[i].Rule.Evaluate(params) {
|
||||
if h.list[i].Rule == nil || (h.list[i].Rule != nil && h.list[i].Rule.Evaluate(params)) {
|
||||
return &h.list[i]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue