Files
service-common/config/config.go

79 lines
1.7 KiB
Go

package config
type AppConfig struct {
Name string `yaml:"name"`
}
type LogConfig struct {
Debug bool `yaml:"debug"`
MaxSize int32 `yaml:"maxSize"`
MaxBackups int32 `yaml:"maxBackups"`
MaxAge int32 `yaml:"maxAge"`
Level string `yaml:"level"`
}
type MetricConfig struct {
Prometheus *struct {
Address string `yaml:"address"`
Port int32 `yaml:"port"`
} `yaml:"prometheus"`
Jaeger *struct {
Endpoint string `yaml:"endpoint"`
} `yaml:"jaeger"`
}
type DBConfig struct {
Etcd *EtcdConfig `yaml:"etcd"`
MySQL map[string]*MySQLConfig `yaml:"mysql"`
Mongo map[string]*MongoConfig `yaml:"mongo"`
Redis *RedisConfig `yaml:"redis"`
Kafka *KafkaConfig `yaml:"kafka"`
}
type EtcdConfig struct {
Endpoints []string `yaml:"endpoints"`
}
type MySQLConfig struct {
Dsn string `yaml:"dsn"`
MaxOpenConn int32 `yaml:"maxOpenConn"`
MaxIdleConn int32 `yaml:"maxIdleConn"`
ConnMaxLifetimeSec int32 `yaml:"connMaxLifetimeSec"`
ConnMaxIdleTimeSec int32 `yaml:"connMaxIdleTimeSec"`
LogLevel string `yaml:"logLevel"`
}
type MongoConfig struct {
URI string `yaml:"uri"`
}
type RedisConfig struct {
Addr string `yaml:"addr"`
Password string `yaml:"password"`
DB int `yaml:"db"`
}
type KafkaConfig struct {
Brokers []string `yaml:"brokers"`
}
type ServeConfig struct {
Grpc *GrpcConfig `yaml:"grpc"`
Socket *struct {
Web *AddressConfig `yaml:"web"`
Raw *AddressConfig `yaml:"raw"`
} `yaml:"socket"`
Http *AddressConfig `yaml:"http"`
}
type GrpcConfig struct {
Address string `yaml:"address"`
Port int32 `yaml:"port"`
TTL int64 `yaml:"ttl"`
}
type AddressConfig struct {
Address string `yaml:"address"`
Port int32 `yaml:"port"`
}