Documentation ¶
Index ¶
Constants ¶
View Source
const ( NacosAliServerAddrEnv = "serverAddr" NacosAliPortEnv = "serverPort" NacosAliNamespaceEnv = "namespace" )
keep consistent with the env with alicloud
View Source
const ( NacosDefaultServerAddr = "127.0.0.1" NacosDefaultPort = 8848 NacosDefaultConfigGroup = "DEFAULT_GROUP" NacosDefaultClientDataID = "{{.ClientServiceName}}.{{.ServerServiceName}}.{{.Category}}" NacosDefaultServerDataID = "{{.ServerServiceName}}.{{.Category}}" )
Variables ¶
This section is empty.
Functions ¶
func NacosAddr ¶ added in v0.4.0
func NacosAddr() string
NacosAddr Get Nacos addr from environment variables
func NacosNameSpaceId ¶ added in v0.4.0
func NacosNameSpaceId() string
NacosNameSpaceId Get Nacos namespace id from environment variables
func NacosPort ¶ added in v0.4.0
func NacosPort() uint64
NacosPort Get Nacos port from environment variables
func NewCustomNacosLogger ¶
Types ¶
type Client ¶
type Client interface { SetParser(ConfigParser) ClientConfigParam(cpc *ConfigParamConfig) (vo.ConfigParam, error) ServerConfigParam(cpc *ConfigParamConfig) (vo.ConfigParam, error) RegisterConfigCallback(vo.ConfigParam, func(string, ConfigParser), int64) DeregisterConfig(vo.ConfigParam, int64) error }
Client the wrapper of nacos client.
type ConfigParamConfig ¶
ConfigParamConfig use for render the dataId or group info by go template, ref: https://pkg.go.dev/text/template The fixed key shows as below.
type ConfigParser ¶
type ConfigParser interface {
Decode(kind vo.ConfigType, data string, config interface{}) error
}
ConfigParser the parser for nacos config.
type CustomFunction ¶
type CustomFunction func(*vo.ConfigParam)
CustomFunction use for customize the config parameters.
type Options ¶
type Options struct { Address string Port uint64 NamespaceID string RegionID string Group string ServerDataIDFormat string ClientDataIDFormat string CustomLogger logger.Logger Password string Username string ConfigParser ConfigParser }
Options nacos config options. All the fields have default value.
Click to show internal directories.
Click to hide internal directories.