nacos

package
v0.0.0-...-20002e4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHRegistryInfo

func GetHRegistryInfo(serverName, serverHost string, serverPort int) (registry.Registry, *registry.Info)

func GetKRegistryInfo

func GetKRegistryInfo(serverName, serverHost string, serverPort int) (registry.Registry, *registry.Info)

GetKRegistryInfo 获取服务注册服务的信息.

func GetKResolve

func GetKResolve(group string) (discovery.Resolver, error)

func InitNacos

func InitNacos(dataId, group string) (string, error)

InitNacos 根据不同的环境初始化 nacos. 返回对应 DataId 和 Group 下的配置数据.

Types

type Config

type Config struct {
	Local *ConfigInfo `json:"local" mapstructure:"local"`
	Dev   *ConfigInfo `json:"dev" mapstructure:"dev"`
	Test  *ConfigInfo `json:"test" mapstructure:"test"`
	Prod  *ConfigInfo `json:"prod" mapstructure:"prod"`
}

Config 各个环境的信息.

type ConfigInfo

type ConfigInfo struct {
	Host      string `mapstructure:"host"`
	Port      uint64 `mapstructure:"port"`
	Namespace string `mapstructure:"namespace"`
	User      string `mapstructure:"user"`
	Password  string `mapstructure:"password"`
	DataId    string `mapstructure:"dataid"`
	Group     string `mapstructure:"group"`
	Weight    int    `mapstructure:"weight"`
}

ConfigInfo 具体的配置信息.

Jump to

Keyboard shortcuts

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