-
Notifications
You must be signed in to change notification settings - Fork 1
/
configurator.go
43 lines (34 loc) · 948 Bytes
/
configurator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package config
import (
av1 "github.com/alexfalkowski/auth/client/v1/config"
"github.com/alexfalkowski/go-service/cmd"
"github.com/alexfalkowski/go-service/config"
v1 "github.com/alexfalkowski/konfig/client/v1/config"
"github.com/alexfalkowski/konfig/health"
"github.com/alexfalkowski/konfig/source"
)
// NewConfigurator for config.
func NewConfigurator(i *cmd.InputConfig) (config.Configurator, error) {
c := &Config{}
return c, i.Unmarshal(c)
}
func v1Client(cfg config.Configurator) *v1.Config {
c := cfg.(*Config)
if c.Client == nil {
return nil
}
return c.Client.V1
}
func v1AuthClientConfig(cfg config.Configurator) *av1.Config {
c := cfg.(*Config)
if c.Auth == nil || c.Auth.Client == nil {
return nil
}
return c.Auth.Client.V1
}
func healthConfig(cfg config.Configurator) *health.Config {
return cfg.(*Config).Health
}
func sourceConfig(cfg config.Configurator) *source.Config {
return cfg.(*Config).Source
}