Documentation
¶
Index ¶
- Variables
- func Add(name string, configFn ConfigFunc)
- func Env(envName string, defaultValue ...interface{}) interface{}
- func Get(path string, defaultValue ...interface{}) string
- func GetAny(path string, defaultValue ...interface{}) any
- func GetBool(path string, defaultValue ...interface{}) bool
- func GetFloat64(path string, defaultValue ...interface{}) float64
- func GetInt(path string, defaultValue ...interface{}) int
- func GetInt64(path string, defaultValue ...interface{}) int64
- func GetString(path string, defaultValue ...interface{}) string
- func GetUint(path string, defaultValue ...interface{}) uint
- func IsNacosEnabled() bool
- func NacosClient() config_client.IConfigClient
- func SetupConfig(env string) (err error)
- type ConfigFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigFuncs map[string]ConfigFunc
Functions ¶
func Env ¶
func Env(envName string, defaultValue ...interface{}) interface{}
Env 读取环境变量,支持默认值 优先级:os.Getenv > viper(.env 文件 + APPENV_ 前缀环境变量) > 默认值
func GetFloat64 ¶
GetFloat64 获取 float64 类型的配置信息
func NacosClient ¶ added in v0.1.0
func NacosClient() config_client.IConfigClient
NacosClient 返回 Nacos 配置客户端实例,未启用时返回 nil
func SetupConfig ¶
SetupConfig 初始化配置信息,完成对环境变量以及 config 信息的加载
Types ¶
type ConfigFunc ¶
type ConfigFunc func() map[string]interface{}
Click to show internal directories.
Click to hide internal directories.