+17
@@ -0,0 +1,17 @@
|
||||
package events
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// SendEmailsEvent instructs the notification service to send grouped emails
|
||||
type SendEmailsEvent struct {
|
||||
Interval string
|
||||
}
|
||||
|
||||
// Unmarshal to fulfill umarshaller interface
|
||||
func (SendEmailsEvent) Unmarshal(v []byte) (interface{}, error) {
|
||||
e := SendEmailsEvent{}
|
||||
err := json.Unmarshal(v, &e)
|
||||
return e, err
|
||||
}
|
||||
+13
@@ -114,9 +114,22 @@ func (a *authorizer) GetInfoByDomain(_ context.Context, domain string) (*ocmprov
|
||||
return nil, err
|
||||
}
|
||||
for _, p := range a.providers {
|
||||
// we can exit early if this an exact match
|
||||
if strings.Contains(p.Domain, normalizedDomain) {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// check if the domain matches a regex
|
||||
if ok, err := regexp.MatchString(p.Domain, normalizedDomain); ok && err == nil {
|
||||
// overwrite wildcards with the actual domain
|
||||
for i, s := range p.Services {
|
||||
s.Endpoint.Path = strings.ReplaceAll(s.Endpoint.Path, p.Domain, normalizedDomain)
|
||||
s.Host = strings.ReplaceAll(s.Host, p.Domain, normalizedDomain)
|
||||
p.Services[i] = s
|
||||
}
|
||||
p.Domain = normalizedDomain
|
||||
return p, nil
|
||||
}
|
||||
}
|
||||
return nil, errtypes.NotFound(domain)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user