env

package
v3.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppConfig

func GetAppConfig(newAppConfig *config.AppConfig) *config.AppConfig

GetAppConfig 获取app配置

func GetConfigFileExecutor

func GetConfigFileExecutor() config.File

GetConfigFileExecutor 获取文件执行器

func GetCurrentApolloConfig

func GetCurrentApolloConfig() map[string]*ApolloConnConfig

GetCurrentApolloConfig 获取Apollo链接配置

func GetCurrentApolloConfigReleaseKey

func GetCurrentApolloConfigReleaseKey(namespace string) string

GetCurrentApolloConfigReleaseKey 获取release key

func GetPlainAppConfig

func GetPlainAppConfig() *config.AppConfig

GetPlainAppConfig 获取原始配置

func GetServers

func GetServers() *sync.Map

GetServers 获取服务器数组

func GetServersLen

func GetServersLen() int

GetServersLen 获取服务器数组长度

func GetServicesConfigURL

func GetServicesConfigURL(config *config.AppConfig) string

GetServicesConfigURL 获取服务器列表url

func InitConfig

func InitConfig(loadAppConfig func() (*config.AppConfig, error)) (err error)

InitConfig 使用指定配置初始化配置

func InitFileConfig

func InitFileConfig()

InitFileConfig 使用文件初始化配置

func SetCurrentApolloConfig

func SetCurrentApolloConfig(namespace string, connConfig *ApolloConnConfig)

SetCurrentApolloConfig 设置apollo配置

func SetDownNode

func SetDownNode(host string)

SetDownNode 设置失效节点

func SplitNamespaces

func SplitNamespaces(namespacesStr string, callback func(namespace string)) sync.Map

SplitNamespaces 根据namespace字符串分割后,并执行callback函数

func SyncServerIPListSuccessCallBack

func SyncServerIPListSuccessCallBack(responseBody []byte) (o interface{}, err error)

SyncServerIPListSuccessCallBack 同步服务器列表成功后的回调

func Unmarshal

func Unmarshal(b []byte) (interface{}, error)

Unmarshal 反序列化

Types

type ApolloConfig

type ApolloConfig struct {
	ApolloConnConfig
	Configurations map[string]interface{} `json:"configurations"`
}

ApolloConfig apollo配置

func (*ApolloConfig) Init

func (a *ApolloConfig) Init(appID string, cluster string, namespace string)

Init 初始化

type ApolloConnConfig

type ApolloConnConfig struct {
	AppID         string `json:"appId"`
	Cluster       string `json:"cluster"`
	NamespaceName string `json:"namespaceName"`
	ReleaseKey    string `json:"releaseKey"`
	sync.RWMutex
}

ApolloConnConfig apollo链接配置

type ConnectConfig

type ConnectConfig struct {
	//设置到http.client中timeout字段
	Timeout time.Duration
	//连接接口的uri
	URI string
	//是否重试
	IsRetry bool
	//appID
	AppID string
	//密钥
	Secret string
}

ConnectConfig 网络请求配置

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL