Documentation ¶
Index ¶
- Constants
- func PaseConfigFile(confFile string) (string, string, error)
- func SubString(str string, begin, length int) (substr string)
- type AppConfig
- func (c *AppConfig) GetAppFlags(deployEnv, namespace, appName, appVersion string, ...) error
- func (c *AppConfig) GetConfdRemoteAddrs() []string
- func (c *AppConfig) GetLocalConfigFile() string
- func (c *AppConfig) GetRemoteConfigType() string
- func (c *AppConfig) GetRootKey() string
- func (c *AppConfig) IsLocal() bool
- func (c *AppConfig) IsSync() bool
- func (c *AppConfig) String() string
- type ConfLocalFile
- type Confd
- func (cfd *Confd) AllKeys() []string
- func (cfd *Confd) BindConfig() error
- func (cfd *Confd) Get(key string) interface{}
- func (cfd *Confd) GetBool(key string) bool
- func (cfd *Confd) GetDuration(key string) time.Duration
- func (cfd *Confd) GetInt(key string) int
- func (cfd *Confd) GetRootKey() string
- func (cfd *Confd) GetString(key string) string
- func (cfd *Confd) GetStringMap(key string) map[string]interface{}
- func (cfd *Confd) GetStringMapString(key string) map[string]string
- func (cfd *Confd) GetStringMapStringSlice(key string) map[string][]string
- func (cfd *Confd) GetStringSlice(key string) []string
- func (cfd *Confd) InConfig(key string) bool
- func (cfd *Confd) IsSet(key string) bool
- func (cfd *Confd) ReadConfigFileToRemote() error
- func (cfd *Confd) String() string
- func (cfd *Confd) WatchRemoteConfig() error
- type EtcdConfd
- func (ce *EtcdConfd) LoadConfigFromRemote(loadViper *viper.Viper, rootKey, configType string) error
- func (ce *EtcdConfd) ReadConfigFileToETCD(confFile, rootKey string) error
- func (ce *EtcdConfd) SyncToEtcd(addrs, rootkey, confFile string) error
- func (ce *EtcdConfd) WatchRemoteConfig(loadViper *viper.Viper, rootKey, configType string) error
Constants ¶
View Source
const ( CONF_KEY_env = "env" CONF_KEY_namespace = "namespace" CONF_KEY_service_redis_port = "service.redis.port" )
Variables ¶
This section is empty.
Functions ¶
func PaseConfigFile ¶
PaseConfigFile 解析文件,得到path,ext
Types ¶
type AppConfig ¶
type AppConfig struct {
// contains filtered or unexported fields
}
func DefaultAppConfig ¶
func DefaultAppConfig() *AppConfig
func NewAppConfig ¶
func NewAppConfig() *AppConfig
func (*AppConfig) GetAppFlags ¶
func (c *AppConfig) GetAppFlags(deployEnv, namespace, appName, appVersion string, confdLocalFile, confdRemoteAddrs, confdRemoteConfigType string, confdSyncMode bool) error
GetAppFlags 从命令行参数与环境变量中获取参数
func (*AppConfig) GetConfdRemoteAddrs ¶
func (*AppConfig) GetLocalConfigFile ¶
func (*AppConfig) GetRemoteConfigType ¶
func (*AppConfig) GetRootKey ¶
type ConfLocalFile ¶
type ConfLocalFile struct { }
//Config -
func NewConfLocalFile ¶
func NewConfLocalFile() *ConfLocalFile
func (*ConfLocalFile) LoadConfigFromLocalFile ¶
func (cf *ConfLocalFile) LoadConfigFromLocalFile(loadViper *viper.Viper, confFile string) error
func (*ConfLocalFile) ReadConfig ¶
type Confd ¶
type Confd struct {
// contains filtered or unexported fields
}
func (*Confd) BindConfig ¶
func (*Confd) GetRootKey ¶
func (*Confd) GetStringMap ¶
func (*Confd) GetStringMapString ¶
func (*Confd) GetStringMapStringSlice ¶
func (*Confd) GetStringSlice ¶
func (*Confd) ReadConfigFileToRemote ¶
func (*Confd) WatchRemoteConfig ¶
type EtcdConfd ¶
type EtcdConfd struct {
// contains filtered or unexported fields
}
EtcdConfd
func NewEtcdConfd ¶
func (*EtcdConfd) LoadConfigFromRemote ¶
loadConfigFromRemote 依server的rootkey,取出对应的配置文件,并解析更新当前配置
func (*EtcdConfd) ReadConfigFileToETCD ¶
func (*EtcdConfd) SyncToEtcd ¶
Click to show internal directories.
Click to hide internal directories.