common_config

package
v0.4.14 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppEnv = &struct {
	Env string `yaml:"app-env"`
}{
	Env: "DEV",
}

AppEnv 标记当前服务进程的运行环境

View Source
var AppSign = &struct {
	Sign map[string]string `yaml:"sign"`
}{
	Sign: make(map[string]string),
}

AppSign 配置文件 - 所有服务的签名配置(在微服务间通讯时验签)

View Source
var BootConfig = &BoostrapConfig{HttpPort: "8080"}

BootConfig 项目启动引导配置

View Source
var PriorityNetwork = &struct {
	Networks []string `yaml:"priority-network"`
}{
	Networks: make([]string, 0),
}

PriorityNetwork 优先网卡选择配置

Functions

func GetAppName

func GetAppName() string

GetAppName 获取当前运行服务进程的服务名称

func GetConfigSecretKey

func GetConfigSecretKey() string

GetConfigSecretKey 获取配置加密密钥(不同环境有不同的密钥,用以解密nacos配置文件中使用ENC()的加密字符串)

Types

type BoostrapConfig

type BoostrapConfig struct {
	HttpPort        string
	Logger          Logger `yaml:"logger"`
	Nacos           Nacos  `yaml:"nacos"`
	ConfigSecretKey string `yaml:"config-secret-key"`
}

BoostrapConfig bootstrap.yml 对应结构体

type Logger added in v0.3.3

type Logger struct {
	Path string `json:"path"`
}

Logger bootstrap.yml 对应结构体

func GetLogCfg

func GetLogCfg() Logger

GetLogCfg 获取日志配置

type Nacos added in v0.3.3

type Nacos struct {
	Addr                string `yaml:"addr"`
	Namespace           string `yaml:"namespace"`
	Username            string `yaml:"username"`
	Password            string `yaml:"password"`
	AppName             string `yaml:"app-name"`
	DataIds             string `yaml:"data-ids"`
	Cluster             string `yaml:"cluster"`
	AvailabilityCluster string `yaml:"availability-cluster"`
}

Nacos bootstrap.yml 对应结构体

func GetNacosCfg

func GetNacosCfg() Nacos

GetNacosCfg 获取nacos配置

Jump to

Keyboard shortcuts

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