Documentation
¶
Overview ¶
Package config manages all app-level configs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MySQL *MySQLConfig `json:"mysql" mapstructure:"mysql"` REST *RESTServerConfig `json:"rest" mapstructure:"rest"` GRPC *GRPCServerConfig `json:"grpc" mapstructure:"grpc"` Config string `json:"config" mapstructure:"config"` }
Config is the root struct that holds all app-level configs. One common use case is to create an empty value of Config and unmarshal values into it from sources like viper so that app-level configs don't vary throughout the whole lifecycle of the app.
func NewEmptyConfig ¶
func NewEmptyConfig() *Config
NewEmptyConfig returns an empty value of Config.
type GRPCInsecureServingConfig ¶
type GRPCInsecureServingConfig struct { Host string `json:"host" mapstructure:"host"` Port int `json:"port" mapstructure:"port"` }
GRPCInsecureServingConfig holds the configs for the insecure serving of gRPC server.
func (*GRPCInsecureServingConfig) Addr ¶
func (c *GRPCInsecureServingConfig) Addr() string
Addr returns the full address(host:port).
type GRPCServerConfig ¶
type GRPCServerConfig struct {
Insecure *GRPCInsecureServingConfig `json:"insecure" mapstructure:"insecure"`
}
GRPCServerConfig is the root struct for gRPC server related configs.
type MySQLConfig ¶
type MySQLConfig struct { User string `json:"user" mapstructure:"user"` Pwd string `json:"pwd" mapstructure:"pwd"` Host string `json:"host" mapstructure:"host"` Port int `json:"port" mapstructure:"port"` Database string `json:"database" mapstructure:"database"` Charset string `json:"charset" mapstructure:"charset"` ParseTime bool `json:"parse-time" mapstructure:"parse-time"` Loc string `json:"loc" mapstructure:"loc"` MaxIdleConns int `json:"max-idle-conns" mapstructure:"max-idle-conns"` MaxOpenConns int `json:"max-open-conns" mapstructure:"max-open-conns"` MaxConnLifetime time.Duration `json:"max-conn-lifetime" mapstructure:"max-conn-lifetime"` LogLevel int `json:"log-level" mapstructure:"log-level"` }
MySQLConfig is the root struct for MySQL related configs.
type RESTInsecureServingConfig ¶
type RESTInsecureServingConfig struct { Host string `json:"host" mapstructure:"host"` Port int `json:"port" mapstructure:"port"` }
RESTInsecureServingConfig holds the configs for the insecure serving of REST server.
func (*RESTInsecureServingConfig) Addr ¶
func (c *RESTInsecureServingConfig) Addr() string
Addr returns the full address(host:port).
type RESTServerConfig ¶
type RESTServerConfig struct { Insecure *RESTInsecureServingConfig `json:"insecure" mapstructure:"insecure"` Mode string `json:"mode" mapstructure:"mode"` Middlewares []string `json:"middlewares" mapstructure:"middlewares"` UseHealthz bool `json:"use-healthz" mapstructure:"use-healthz"` }
RESTServerConfig is the root struct for REST server related configs.