Skip to content

Commit

Permalink
parse the service name
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Jul 7, 2018
1 parent 6730e1c commit 1960f85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1960f85

Please sign in to comment.