config

package
v1.0.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Define the tag name for setting autowired value of Options
	// sc equals stack-config :)
	// todo support custom tagName
	DefaultOptionsTagName     = "sc"
	DefaultHierarchySeparator = "."
)
View Source
var (
	DefaultConfig = NewConfig()
)

Functions

func Get

func Get(path ...string) reader.Value

func RegisterOptions

func RegisterOptions(options ...interface{})

Types

type Config

type Config interface {
	reader.Values
	Init(opts ...Option) error
	Close() error
}

func NewConfig

func NewConfig(opts ...Option) Config

Init Stack's Config component Any developer Don't use this Func anywhere. NewConfig works for Stack Framework only

type Option

type Option func(o *Options)

func Context

func Context(ctx context.Context) Option

func HierarchyMerge

func HierarchyMerge(h bool) Option

func Source

func Source(s ...source.Source) Option

func Storage

func Storage(s bool) Option

func Watch

func Watch(w bool) Option

type Options

type Options struct {
	Sources []source.Source
	Storage bool
	Watch   bool
	// HierarchyMerge merges the query args to one
	// eg. Get("a","b","c") can be used as Get("a.b.c")
	// the default is false
	HierarchyMerge bool

	Context context.Context
}

Jump to

Keyboard shortcuts

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