Add working grpc proxy config

This commit is contained in:
Asim Aslam
2019-06-18 18:51:52 +01:00
parent f65694670e
commit d3a6297b17
16 changed files with 785 additions and 86 deletions

View File

@@ -38,3 +38,20 @@ func ServiceMethod(m string) (string, string, error) {
return parts[0], parts[1], nil
}
// ServiceFromMethod returns the service
// /service.Foo/Bar => service
func ServiceFromMethod(m string) string {
if len(m) == 0 {
return m
}
if m[0] != '/' {
return m
}
parts := strings.Split(m, "/")
if len(parts) < 3 {
return m
}
parts = strings.Split(parts[1], ".")
return strings.Join(parts[:len(parts)-1], ".")
}