Skip to content

Commit

Permalink
feat: support https sns protocol (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementlecorre authored and VaibhavPage committed Dec 25, 2019
1 parent 2bdb384 commit cc8914d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 9 additions & 1 deletion gateways/server/aws-sns/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package aws_sns
import (
"io/ioutil"
"net/http"
"regexp"

"github.com/argoproj/argo-events/common"
"github.com/argoproj/argo-events/gateways"
Expand Down Expand Up @@ -143,7 +144,14 @@ func (router *Router) PostActivate() error {
formattedUrl := common.FormattedURL(snsEventSource.Webhook.URL, snsEventSource.Webhook.Endpoint)
if _, err := router.session.Subscribe(&snslib.SubscribeInput{
Endpoint: &formattedUrl,
Protocol: &snsProtocol,
Protocol: func(endpoint string) *string {
Protocol := "http"
if matched, _ := regexp.MatchString(`https://.*`, endpoint); matched {
Protocol = "https"
return &Protocol
}
return &Protocol
}(formattedUrl),
TopicArn: &snsEventSource.TopicArn,
}); err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions gateways/server/aws-sns/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const (
messageTypeNotification = "Notification"
)

var (
snsProtocol = "http"
)

// EventListener implements Eventing for aws sns event source
type EventListener struct {
// Logger to log stuff
Expand Down

0 comments on commit cc8914d

Please sign in to comment.