| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package configs
- //配置文件序列化对象
- type Config struct {
- Mysql Mysql `mapstructure:"mysql"`
- Redis Redis
- App App
- }
- type Mysql struct {
- Host string `mapstructure:"host"`
- Port int `mapstructure:"port"`
- Username string `mapstructure:"username"`
- Password string `mapstructure:"password"`
- Database string `mapstructure:"database"`
- Charset string `mapstructure:"charset"`
- }
- type Redis struct {
- Host string
- Password string
- Db int64
- }
- type App struct {
- ServerName string `mapstructure:"name"`
- Version string `mapstructure:"version"`
- InternalAddr string `mapstructure:"internal_addr"`
- InternalGrpcAddr string `mapstructure:"internal_grpc_addr"`
- Env string `mapstructure:"env"`
- LogLevel string `mapstructure:"log_level"`
- InternalServicePath string `mapstructure:"internal_service_path"`
- MetricAddr string `mapstructure:"metric_path"`
- RunModePath string `mapstructure:"runmode_path"`
- }
- func NewConfig() *Config {
- return &Config{}
- }
|