config

package
v4.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitNamespaces

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

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

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 AppConfig

type AppConfig struct {
	AppID            string `json:"appId"`
	Cluster          string `json:"cluster"`
	NamespaceName    string `json:"namespaceName"`
	IP               string `json:"ip"`
	NextTryConnTime  int64  `json:"-"`
	IsBackupConfig   bool   `default:"true" json:"isBackupConfig"`
	BackupConfigPath string `json:"backupConfigPath"`
	Secret           string `json:"secret"`
	// contains filtered or unexported fields
}

AppConfig 配置文件

func (*AppConfig) GetBackupConfigPath

func (a *AppConfig) GetBackupConfigPath() string

GetBackupConfigPath GetBackupConfigPath

func (*AppConfig) GetCurrentApolloConfig

func (a *AppConfig) GetCurrentApolloConfig() *CurrentApolloConfig

GetCurrentApolloConfig nolint

func (*AppConfig) GetHost

func (a *AppConfig) GetHost() string

GetHost GetHost

func (*AppConfig) GetIsBackupConfig

func (a *AppConfig) GetIsBackupConfig() bool

GetIsBackupConfig whether backup config after fetch config from apollo false : no true : yes (default)

func (*AppConfig) GetNotificationsMap

func (a *AppConfig) GetNotificationsMap() *notificationsMap

GetNotificationsMap 获取notificationsMap

func (*AppConfig) GetServers

func (a *AppConfig) GetServers() *sync.Map

GetServers 获取服务器数组

func (*AppConfig) GetServersLen

func (a *AppConfig) GetServersLen() int

GetServersLen 获取服务器数组长度

func (*AppConfig) GetServicesConfigURL

func (a *AppConfig) GetServicesConfigURL() string

GetServicesConfigURL 获取服务器列表url

func (*AppConfig) Init

func (a *AppConfig) Init()

Init 初始化notificationsMap

func (*AppConfig) IsConnectDirectly

func (a *AppConfig) IsConnectDirectly() bool

IsConnectDirectly is connect by ip directly false : no true : yes

func (*AppConfig) SetCurrentApolloConfig

func (a *AppConfig) SetCurrentApolloConfig(apolloConfig *ApolloConnConfig)

SetCurrentApolloConfig nolint

func (*AppConfig) SetDownNode

func (a *AppConfig) SetDownNode(host string)

SetDownNode 设置失效节点

func (*AppConfig) SetNextTryConnTime

func (a *AppConfig) SetNextTryConnTime(nextTryConnectPeriod int64)

SetNextTryConnTime if this connect is fail will set this time

type CurrentApolloConfig

type CurrentApolloConfig struct {
	// contains filtered or unexported fields
}

CurrentApolloConfig 当前 apollo 返回的配置信息

func CreateCurrentApolloConfig

func CreateCurrentApolloConfig() *CurrentApolloConfig

CreateCurrentApolloConfig nolint

func (*CurrentApolloConfig) Get

GetCurrentApolloConfig 获取Apollo链接配置

func (*CurrentApolloConfig) GetReleaseKey

func (c *CurrentApolloConfig) GetReleaseKey(namespace string) string

GetCurrentApolloConfigReleaseKey 获取release key

func (*CurrentApolloConfig) Set

func (c *CurrentApolloConfig) Set(namespace string, connConfig *ApolloConnConfig)

SetCurrentApolloConfig 设置apollo配置

type File

type File interface {
	Load(fileName string, unmarshal func([]byte) (interface{}, error)) (interface{}, error)

	Write(content interface{}, configPath string) error
}

File 读写配置文件

type Notification

type Notification struct {
	NamespaceName  string `json:"namespaceName"`
	NotificationID int64  `json:"notificationId"`
}

Notification 用于保存 apollo Notification 信息

type ServerInfo

type ServerInfo struct {
	AppName     string `json:"appName"`
	InstanceID  string `json:"instanceId"`
	HomepageURL string `json:"homepageUrl"`
	IsDown      bool   `json:"-"`
}

ServerInfo 服务器信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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