-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.go
72 lines (59 loc) · 2.08 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
63
64
65
66
67
68
69
70
71
72
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/debug"
"github.com/alexfalkowski/go-service/env"
"github.com/alexfalkowski/go-service/telemetry"
"github.com/alexfalkowski/go-service/telemetry/logger/zap"
"github.com/alexfalkowski/go-service/telemetry/tracer"
"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 {
Environment env.Environment `yaml:"environment" json:"environment" toml:"environment"`
Debug debug.Config `yaml:"debug" json:"debug" toml:"debug"`
Cache cache.Config `yaml:"cache" json:"cache" toml:"cache"`
SQL sql.Config `yaml:"sql" json:"sql" toml:"sql"`
Telemetry telemetry.Config `yaml:"telemetry" json:"telemetry" toml:"telemetry"`
Transport transport.Config `yaml:"transport" json:"transport" toml:"transport"`
}
func (cfg *Config) EnvironmentConfig() env.Environment {
return cfg.Environment
}
func (cfg *Config) DebugConfig() *debug.Config {
return &cfg.Debug
}
func (cfg *Config) RedisConfig() *redis.Config {
return &cfg.Cache.Redis
}
func (cfg *Config) RistrettoConfig() *ristretto.Config {
return &cfg.Cache.Ristretto
}
func (cfg *Config) PGConfig() *pg.Config {
return &cfg.SQL.PG
}
func (cfg *Config) TracerConfig() *tracer.Config {
return &cfg.Telemetry.Tracer
}
func (cfg *Config) LoggerConfig() *zap.Config {
return &cfg.Telemetry.Logger
}
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
}