config

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 135

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"`
	IsBackupConfig    bool   `default:"true" json:"isBackupConfig"`
	BackupConfigPath  string `json:"backupConfigPath"`
	Secret            string `json:"secret"`
	SyncServerTimeout int    `json:"syncServerTimeout"`
	// MustStart 可用于控制第一次同步必须成功
	MustStart bool `default:"false"`
	// 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) GetServicesConfigURL

func (a *AppConfig) GetServicesConfigURL() string

GetServicesConfigURL 获取服务器列表url

func (*AppConfig) Init

func (a *AppConfig) Init()

Init 初始化notificationsMap

func (*AppConfig) SetCurrentApolloConfig

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

SetCurrentApolloConfig nolint

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