Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding in proper router processing #488

Merged
merged 4 commits into from
Jul 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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