config

package
v0.0.0-...-24cf382 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateManager

func CreateManager(configBasePath string, configInitialMode string, configEnvPrefix string) error

CreateManager - Create a new manager instance

func GetManager

func GetManager() *manager

func NewCategoryNotExistErr

func NewCategoryNotExistErr(key string, err error) error

NewCategoryNotExistErr - return a new instance of CategoryNotExistErr

func NewKeyNotExistErr

func NewKeyNotExistErr(key, category string, err error) error

NewKeyNotExistErr - return a new instance of KeyNotExistErr

func NewRemoteLoadErr

func NewRemoteLoadErr(name interface{}, err error) error

NewRemoteLoadErr - return a new instance of RemoteLoadErr

func NewRemoteResponseErr

func NewRemoteResponseErr(err error) error

NewRemoteResponseErr - return a new instance of RemoteResponseErr

Types

type CategoryNotExistErr

type CategoryNotExistErr struct {
	Key interface{}
	Err error
}

CategoryNotExistErr Error

func (*CategoryNotExistErr) Error

func (err *CategoryNotExistErr) Error() string

Error method - satisfying error interface

type KeyNotExistErr

type KeyNotExistErr struct {
	Key      interface{}
	Category interface{}
	Err      error
}

KeyNotExistErr Error

func (*KeyNotExistErr) Error

func (err *KeyNotExistErr) Error() string

Error method - satisfying error interface

type RemoteLoadErr

type RemoteLoadErr struct {
	Name interface{}
	Err  error
}

RemoteLoadErr Error

func (*RemoteLoadErr) Error

func (err *RemoteLoadErr) Error() string

Error method - satisfying error interface

type RemoteResponseErr

type RemoteResponseErr struct {
	Err error
}

RemoteResponseErr Error

func (*RemoteResponseErr) Error

func (err *RemoteResponseErr) Error() string

Error method - satisfying error interface

type ViperWrapper

type ViperWrapper struct {
	Instance            *viper.Viper
	ConfigPath          []string
	ConfigName          string
	ConfigEnvPrefix     string
	ConfigResourcePlace string
	// contains filtered or unexported fields
}

ViperWrapper object

func (*ViperWrapper) Get

func (w *ViperWrapper) Get(key string, bypass bool) (interface{}, bool)

Get method - returns value base on key

func (*ViperWrapper) Load

func (w *ViperWrapper) Load() error

Load - It creates new instance of Viper and load config file base on ConfigName

func (*ViperWrapper) LoadFromRemote

func (w *ViperWrapper) LoadFromRemote(data []byte) error

LoadFromRemote - loads the configs from the remote server

func (*ViperWrapper) RegisterChangeCallback

func (w *ViperWrapper) RegisterChangeCallback(fn func() interface{})

RegisterChangeCallback - get function and call it when config file changed

func (*ViperWrapper) Set

func (w *ViperWrapper) Set(key string, value interface{}, bypass bool) error

Set method - set value by given key and write it back to file

Jump to

Keyboard shortcuts

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