Documentation
¶
Index ¶
- func Get(key string) interface{}
- func GetAppID() string
- func GetAppName() string
- func GetAppVersion() string
- func GetBool(key string) bool
- func GetConfigFile() string
- func GetDuration(key string) time.Duration
- func GetEnv(key string) string
- func GetFloat64(key string) float64
- func GetGrpcPort() int
- func GetHttpPort() int
- func GetInt(key string) int
- func GetInt32(key string) int32
- func GetInt64(key string) int64
- func GetLogLevel() string
- func GetLogPath() string
- func GetMonitorPort() int
- func GetMysqlLog() bool
- func GetMysqlMaxIdleCons() int
- func GetMysqlMaxIdleTime() int
- func GetMysqlMaxLife() int
- func GetMysqlPoolSize() int
- func GetMysqlUrl() string
- func GetString(key string) string
- func GetUint32(key string) uint32
- func IsProd() bool
- func IsQa() bool
- func Set(key string, value interface{})
- func SetDefault(key string, value interface{})
- type App
- type Conf
- type Interface
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigFile ¶
func GetConfigFile() string
func GetDuration ¶
GetDuration returns the value associated with the key as a time.Duration
func GetFloat64 ¶
GetFloat64 returns the value associated with the key as a float64
func GetMysqlMaxIdleCons ¶
func GetMysqlMaxIdleCons() int
GetMysqlMaxIdleCons get mysql max idle cons
func GetMysqlMaxIdleTime ¶
func GetMysqlMaxIdleTime() int
GetMysqlMaxIdleTime get mysql max idle time
func Set ¶
func Set(key string, value interface{})
Set sets the value for the key in the override register
func SetDefault ¶
func SetDefault(key string, value interface{})
SetDefault sets the default value for this key
Types ¶
type App ¶
type App struct {
AppId string `yaml:"app_id"`
AppName string `yaml:"app_name"`
AppVersion string `yaml:"app_version"`
Env string `yaml:"env"`
HttpPort int32 `yaml:"httpPort"`
GrpcPort int `yaml:"grpcPort"`
MonitorPort int `yaml:"monitorPort"`
Log logCfg `yaml:"log"`
Extra map[string]interface{} `yaml:"extra"`
}
type Conf ¶
Conf represents the config struct
func (*Conf) PreInitConfig ¶
func (c *Conf) PreInitConfig()
PreInitConfig makes viper data declared in env and file available
type Interface ¶
type Interface interface {
InitConfig() error
SetConfigFile(file string) Option
GetConfigFile() string
SetDefault(key string, value interface{})
Set(key string, value interface{})
Bind(v interface{}) error
Get(key string) interface{}
GetString(key string) string
GetBool(key string) bool
GetInt(key string) int
GetUint32(key string) uint32
GetInt32(key string) int32
GetInt64(key string) int64
GetFloat64(key string) float64
GetDuration(key string) time.Duration
}
Interface represents the interface of config
Click to show internal directories.
Click to hide internal directories.