conf

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EnvPrefix = "NETLEAP_"

EnvPrefix 环境变量前缀

Variables

This section is empty.

Functions

func GetConfDirPath added in v1.0.8

func GetConfDirPath() string

func GetConfigurationPath added in v1.0.8

func GetConfigurationPath() string

func GetPath added in v1.0.8

func GetPath(fileName string) string

func GetPluginDirectory added in v1.0.8

func GetPluginDirectory() string

func LoadEnv added in v1.0.8

func LoadEnv(config interface{}) error

LoadEnv 从环境变量加载配置

func NormalizeEnvName added in v1.0.8

func NormalizeEnvName(name string) string

func ValidateConfig added in v1.0.8

func ValidateConfig(config interface{}) error

ValidateConfig 验证配置

Types

type EnvFlag added in v1.0.8

type EnvFlag struct {
	Name    string
	AltName string
}

func NewEnvFlag added in v1.0.8

func NewEnvFlag(name string) EnvFlag

func (EnvFlag) GetValue added in v1.0.8

func (f EnvFlag) GetValue(defaultValue func() string) string

func (EnvFlag) GetValueAsInt added in v1.0.8

func (f EnvFlag) GetValueAsInt(defaultValue int) int

type Manager added in v1.0.8

type Manager[T any] struct {
	// contains filtered or unexported fields
}

Manager 配置管理器

func New added in v1.0.8

func New[T any](path string, onChange func(*T)) (*Manager[T], error)

New 创建配置管理器

func (*Manager[T]) Close added in v1.0.8

func (m *Manager[T]) Close() error

Close 关闭配置管理器

func (*Manager[T]) Get added in v1.0.8

func (m *Manager[T]) Get() *T

Get 获取配置

func (*Manager[T]) Load added in v1.0.8

func (m *Manager[T]) Load() error

Load 加载配置

type Validator added in v1.0.8

type Validator interface {
	Validate() error
}

Validator 配置验证器接口

type Watcher added in v1.0.8

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

Watcher 文件监听器

func NewWatcher added in v1.0.8

func NewWatcher(path string, interval time.Duration, onChange func()) *Watcher

NewWatcher 创建文件监听器

func (*Watcher) Start added in v1.0.8

func (w *Watcher) Start() error

Start 启动监听

func (*Watcher) Stop added in v1.0.8

func (w *Watcher) Stop()

Stop 停止监听

Jump to

Keyboard shortcuts

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