config

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(source ...source.Source) error

Load config sources

Types

type Config

type Config interface {
	// Values provide the reader.Values interface
	reader.Values
	// Init the config
	Init(opts ...Option) error
	// Options in the config
	Options() *Options
	// Close Stop the config loader
	Close() error
	// Load config sources
	Load(source ...source.Source) error
}

Config is an interface abstraction for dynamic configuration

var (
	//DefaultConfig Default Config Manager
	DefaultConfig Config
)

func LoadApollo added in v0.4.2

func LoadApollo(apolloCfg *apollo.Config) (Config, error)

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile is short hand for creating a file source and loading it

func LoadYaml

func LoadYaml(cfgStr string) (Config, error)

func NewConfig

func NewConfig(opts ...Option) (Config, error)

NewConfig returns new config

type Option

type Option func(o *Options)

Option is the decorators func of change options variable

func WithLoader

func WithLoader(l loader.Loader) Option

WithLoader sets the loader for manager config

func WithReader

func WithReader(r reader.Reader) Option

WithReader sets the config reader

func WithSource

func WithSource(s source.Source) Option

WithSource appends a source to list of sources

type Options

type Options struct {
	Loader loader.Loader
	Reader reader.Reader
	//Source is cache of options
	Source []source.Source
}

Directories

Path Synopsis
memory
Package memory loader will load config info from source, encoder it and store to memory
Package memory loader will load config info from source, encoder it and store to memory

Jump to

Keyboard shortcuts

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