autoconf

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigPath = "./configs"
)

Variables

View Source
var (
	ErrConfigCenterOptionsType = errors.New("config center options type error")
)

Functions

func FromApollo

func FromApollo(apolloConfig *apollo.ApolloBaseConfig, conf []interface{}) error

func FromEnv

func FromEnv(logLevel logrus.Level, confPrefix string, conf []interface{}) error

func FromEtcd

func FromEtcd(config *etcd.BaseConfig, prefix string, conf []any) error

func FromNacos

func FromNacos(logLevel logrus.Level, nacosConfig *nacos.BaseConfig, prefix string, conf []any) error

func GetDefaultFromEnv

func GetDefaultFromEnv(confPrefix string, conf []interface{}) []envconfig.EnvVar

func Initialize

func Initialize(config ...any)

Types

type ConfigManager

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

ConfigManager 配置自动装配工具,依照优先读取本地配置文件、环境变量、配置中心的顺序进行配置的自动装配

func NewConfigManager

func NewConfigManager(opt Options, configs ...any) *ConfigManager

NewConfigManager 创建配置自动装配工具

func (*ConfigManager) Autoconf

func (m *ConfigManager) Autoconf() error

func (*ConfigManager) MustAutoconf

func (m *ConfigManager) MustAutoconf()

type Initializer

type Initializer interface {
	Init()
}

type Options

type Options struct {
	LogLevel            logrus.Level
	ConfigPath          string
	EnvConfigPrefix     string
	ConfigCenterType    enum.ConfigCenterType
	ConfigCenterOptions any
}

Jump to

Keyboard shortcuts

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