dynconfig

package
v2.0.1-beta.4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LocalSourceType represents read configuration from local file
	LocalSourceType = "local"

	// ManagerSourceType represents pulling configuration from manager
	ManagerSourceType = "manager"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DecoderConfigOption

type DecoderConfigOption func(*mapstructure.DecoderConfig)

A DecoderConfigOption can be passed to dynconfig Unmarshal to configure mapstructure.DecoderConfig options

type Dynconfig

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

func New

func New(sourceType SourceType, options ...Option) (*Dynconfig, error)

New returns a new dynconfig instance

func NewDynconfigWithOptions

func NewDynconfigWithOptions(sourceType SourceType, options ...Option) (*Dynconfig, error)

NewDynconfigWithOptions constructs a new instance of a dynconfig with additional options.

func (*Dynconfig) Unmarshal

func (d *Dynconfig) Unmarshal(rawVal interface{}) error

Unmarshal unmarshals the config into a Struct. Make sure that the tags on the fields of the structure are properly set.

type ManagerClient

type ManagerClient interface {
	Get() (interface{}, error)
}

managerClient is a client of manager

type Option

type Option func(d *Dynconfig) error

Option is a functional option for configuring the dynconfig

func WithCachePath

func WithCachePath(p string) Option

WithCachePath set the cache file path

func WithExpireTime

func WithExpireTime(e time.Duration) Option

WithExpireTime set the expire time for cache

func WithLocalConfigPath

func WithLocalConfigPath(p string) Option

WithLocalConfigPath set the file path

func WithManagerClient

func WithManagerClient(c ManagerClient) Option

WithManagerClient set the manager client

type SourceType

type SourceType string

Directories

Path Synopsis
Package mock_manager_client is a generated GoMock package.
Package mock_manager_client is a generated GoMock package.

Jump to

Keyboard shortcuts

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