config

package
v1.25.44-jh Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 18 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = &config{}

Functions

func ValidateCurrent

func ValidateCurrent() error

ValidateCurrent returns a stable error suitable for startup gates.

Types

type ConfigRevision

type ConfigRevision struct {
	Version   uint64
	Hash      string
	ChangedAt time.Time
	Actor     string
	Snapshot  []byte
}

type LogOutput

type LogOutput struct {
	Target  string   `json:"target"`
	Format  string   `json:"format"`
	Fields  []string `json:"fields"`
	LogText string   `json:"logtext"`
	File    string   `json:"file"`
}

LogOutput configures one application log destination. External targets name a registered RecordHandler.

type RegistryConfig

type RegistryConfig struct {
	Name        string `json:"name" bson:"name"`
	Type        string `json:"type" bson:"type"`
	Prefix      string `json:"prefix" bson:"prefix"`
	Namespace   string `json:"namespace" bson:"namespace"`
	Group       string `json:"group" bson:"group"`
	ClusterName string `json:"clusterName" bson:"clusterName"`
}

RegistryConfig describes one named registry instance. Prefix identifies the component configuration (for example nacos-public-test.yml).

type RevisionStore

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

RevisionStore is a bounded, concurrency-safe audit and rollback history.

func NewRevisionStore

func NewRevisionStore(limit int) *RevisionStore

func (*RevisionStore) Get

func (s *RevisionStore) Get(version uint64) (ConfigRevision, bool)

func (*RevisionStore) List

func (s *RevisionStore) List() []ConfigRevision

func (*RevisionStore) Record

func (s *RevisionStore) Record(snapshot []byte, actor string) ConfigRevision

func (*RevisionStore) Rollback

func (s *RevisionStore) Rollback(version uint64) ([]byte, error)

type Snapshot

type Snapshot struct {
	Cnf       *koanf.Koanf
	WorkDir   string
	App       app
	Config    appConfig
	Log       appLog
	Logger    appLogger
	Discovery discovery
	Jwt       jwtConfig
	Sys       sys
	Casbin    casbin
}

Snapshot is an immutable point-in-time copy of the published configuration. It excludes the mutex so it can be returned and read without copying a lock. Nested field types stay unexported on purpose: callers only need to read their exported fields, and must not be able to mutate a published snapshot.

func Current

func Current() Snapshot

Current returns a snapshot that is safe to read while a reload publishes a new configuration. Production code must use this instead of reading the exported fields of Config directly.

func (Snapshot) Exists

func (s Snapshot) Exists(name string) bool

func (Snapshot) GetConfigData

func (s Snapshot) GetConfigData(prefix string) []byte

func (Snapshot) GetConfigString

func (s Snapshot) GetConfigString(name string) string

GetConfigString/Exists read from the snapshot's own koanf instance so a multi-key operation can use one coherent view of the configuration.

func (Snapshot) GetConfigUrl

func (s Snapshot) GetConfigUrl(prefix string) string

type ValidationError

type ValidationError struct{ Key, Message string }

ValidationError describes a rejected configuration key.

func (ValidationError) Error

func (e ValidationError) Error() string

type VictoriaLogsConfig

type VictoriaLogsConfig struct {
	URL                string `json:"url"`
	APIToken           string `json:"api_token" koanf:"api_token"`
	HTTPUser           string `json:"http_user" koanf:"http_user"`
	HTTPPass           string `json:"http_pass" koanf:"http_pass"`
	APICert            string `json:"api_crt" koanf:"api_crt"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify" koanf:"insecure_skip_verify"`
	Request            bool   `json:"request"`
	Client             bool   `json:"client"`
	Timeout            int    `json:"timeout"`
}

VictoriaLogsConfig configures the built-in HTTPS collector.

Jump to

Keyboard shortcuts

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