From 6730e1c208f8e76975272dc1c7e246d7ddfdc0fd Mon Sep 17 00:00:00 2001 From: kpacha Date: Sat, 7 Jul 2018 18:14:48 +0200 Subject: [PATCH 1/2] service name added --- config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.go b/config/config.go index ad7d75257..2de1eefa6 100644 --- a/config/config.go +++ b/config/config.go @@ -31,6 +31,8 @@ var RoutingPattern = ColonRouterPatternBuilder // ServiceConfig defines the krakend service type ServiceConfig struct { + // name of the service + Name string // set of endpoint definitions Endpoints []*EndpointConfig `mapstructure:"endpoints"` // defafult timeout From 1960f85891163af2551e80e36696f5ae182cf842 Mon Sep 17 00:00:00 2001 From: kpacha Date: Sat, 7 Jul 2018 18:33:58 +0200 Subject: [PATCH 2/2] parse the service name --- config/config.go | 2 +- config/parser.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 2de1eefa6..6104bf551 100644 --- a/config/config.go +++ b/config/config.go @@ -32,7 +32,7 @@ var RoutingPattern = ColonRouterPatternBuilder // ServiceConfig defines the krakend service type ServiceConfig struct { // name of the service - Name string + Name string `mapstructure:"name"` // set of endpoint definitions Endpoints []*EndpointConfig `mapstructure:"endpoints"` // defafult timeout diff --git a/config/parser.go b/config/parser.go index 7f7844fdf..662d34f47 100644 --- a/config/parser.go +++ b/config/parser.go @@ -44,6 +44,7 @@ func (p parser) Parse(configFile string) (ServiceConfig, error) { } type parseableServiceConfig struct { + Name string `json:"name"` Endpoints []*parseableEndpointConfig `json:"endpoints"` Timeout string `json:"timeout"` CacheTTL string `json:"cache_ttl"` @@ -72,6 +73,7 @@ type parseableServiceConfig struct { func (p *parseableServiceConfig) normalize() ServiceConfig { cfg := ServiceConfig{ + Name: p.Name, Timeout: parseDuration(p.Timeout), CacheTTL: parseDuration(p.CacheTTL), Host: p.Host,