Skip to content

Commit

Permalink
Adding in proper path processing (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebito91 authored and mthenw committed Jul 24, 2018
1 parent f4be89f commit c563910
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions router/path_hosted.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
package router

import (
"regexp"
"strings"
)

// extractPath extracts path from hosted EG host name (<space>.eventgateway([a-z-]*)?.io|slsgateway.com)
var hostedDomainPattern *regexp.Regexp

func init() {
hostedDomainPattern = regexp.MustCompile("(eventgateway([a-z-]*)?.io|slsgateway.com)")
}

func extractPath(host, path string) string {
subdomain := strings.Split(host, ".")[0]
return basePath + subdomain + path
extracted := path
if hostedDomainPattern.Copy().MatchString(host) {
subdomain := strings.Split(host, ".")[0]
extracted = basePath + subdomain + path
}
return extracted
}

func systemPathFromSpace(space string) string {
Expand Down

0 comments on commit c563910

Please sign in to comment.