From 35978a68641e4a2c250eb681e1814e9091198f11 Mon Sep 17 00:00:00 2001 From: Martin Buhr Date: Fri, 18 Mar 2016 07:59:47 -0400 Subject: [PATCH] Updated RPC capcbilities --- api_definition_manager.go | 10 ++++++++++ config.go | 11 ++++++----- tyk_reverse_proxy_clone.go | 8 ++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/api_definition_manager.go b/api_definition_manager.go index b81a1ea1be5..f91b4217cb2 100644 --- a/api_definition_manager.go +++ b/api_definition_manager.go @@ -524,6 +524,16 @@ func (a *APIDefinitionLoader) LoadDefinitionsFromRPC(orgId string) *[]*APISpec { thisAppConfig.DecodeFromDB() thisAppConfig.RawData = StringDefs[i] // Lets keep a copy for plugable modules + if config.SlaveOptions.BindToSlugsInsteadOfListenPaths { + newListenPath := "/" + thisAppConfig.Slug + "/" + log.Warning("Binding to ", + newListenPath, + " instead of ", + thisAppConfig.Proxy.ListenPath) + + thisAppConfig.Proxy.ListenPath = newListenPath + } + newAppSpec := a.MakeSpec(thisAppConfig) APISpecs = append(APISpecs, &newAppSpec) } diff --git a/config.go b/config.go index a945445fb3b..b269dfcfef0 100644 --- a/config.go +++ b/config.go @@ -75,11 +75,12 @@ type Config struct { OauthRefreshExpire int64 `json:"oauth_refresh_token_expire"` OauthTokenExpire int32 `json:"oauth_token_expire"` SlaveOptions struct { - UseRPC bool `json:"use_rpc"` - ConnectionString string `json:"connection_string"` - RPCKey string `json:"rpc_key"` - APIKey string `json:"api_key"` - EnableRPCCache bool `json:"enable_rpc_cache"` + UseRPC bool `json:"use_rpc"` + ConnectionString string `json:"connection_string"` + RPCKey string `json:"rpc_key"` + APIKey string `json:"api_key"` + EnableRPCCache bool `json:"enable_rpc_cache"` + BindToSlugsInsteadOfListenPaths bool `json:"bind_to_slugs"` } `json:"slave_options"` DisableVirtualPathBlobs bool `json:"disable_virtual_path_blobs"` LocalSessionCache struct { diff --git a/tyk_reverse_proxy_clone.go b/tyk_reverse_proxy_clone.go index a8aa899e6cb..f9e0d71b6dc 100644 --- a/tyk_reverse_proxy_clone.go +++ b/tyk_reverse_proxy_clone.go @@ -244,19 +244,19 @@ func singleJoiningSlash(a, b string) string { switch { case aslash && bslash: - log.Info(a + b) + log.Debug(a + b) return a + b[1:] case !aslash && !bslash: if len(b) > 0 { - log.Info(a + b) + log.Debug(a + b) return a + "/" + b } else { - log.Info(a + b) + log.Debug(a + b) return a } } - log.Info(a + b) + log.Debug(a + b) return a + b }