-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.go
62 lines (51 loc) · 1.65 KB
/
config.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package config
import (
"github.com/alexfalkowski/go-service/cache"
"github.com/alexfalkowski/go-service/cache/redis"
"github.com/alexfalkowski/go-service/cache/ristretto"
"github.com/alexfalkowski/go-service/database/sql"
"github.com/alexfalkowski/go-service/database/sql/pg"
"github.com/alexfalkowski/go-service/security"
"github.com/alexfalkowski/go-service/security/auth0"
"github.com/alexfalkowski/go-service/trace"
"github.com/alexfalkowski/go-service/trace/opentracing"
"github.com/alexfalkowski/go-service/transport"
"github.com/alexfalkowski/go-service/transport/grpc"
"github.com/alexfalkowski/go-service/transport/http"
"github.com/alexfalkowski/go-service/transport/nsq"
)
// Config for the service.
type Config struct {
Cache cache.Config `yaml:"cache"`
Security security.Config `yaml:"security"`
SQL sql.Config `yaml:"sql"`
Trace trace.Config `yaml:"trace"`
Transport transport.Config `yaml:"transport"`
}
func (cfg *Config) RedisConfig() *redis.Config {
return &cfg.Cache.Redis
}
func (cfg *Config) RistrettoConfig() *ristretto.Config {
return &cfg.Cache.Ristretto
}
func (cfg *Config) Auth0Config() *auth0.Config {
return &cfg.Security.Auth0
}
func (cfg *Config) PGConfig() *pg.Config {
return &cfg.SQL.PG
}
func (cfg *Config) OpentracingConfig() *opentracing.Config {
return &cfg.Trace.Opentracing
}
func (cfg *Config) TransportConfig() *transport.Config {
return &cfg.Transport
}
func (cfg *Config) GRPCConfig() *grpc.Config {
return &cfg.Transport.GRPC
}
func (cfg *Config) HTTPConfig() *http.Config {
return &cfg.Transport.HTTP
}
func (cfg *Config) NSQConfig() *nsq.Config {
return &cfg.Transport.NSQ
}