config

package
v1.8.4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CfgManager added in v1.8.0

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

CfgManager ... Configure Manager

func NewDBCfgManager added in v1.8.0

func NewDBCfgManager() *CfgManager

NewDBCfgManager - create DB config manager

func NewInMemoryManager added in v1.8.0

func NewInMemoryManager() *CfgManager

NewInMemoryManager create a manager for unit testing, doesn't involve database or REST

func NewRESTCfgManager added in v1.8.0

func NewRESTCfgManager(configURL, secret string) *CfgManager

NewRESTCfgManager - create REST config manager

func (*CfgManager) DumpTrace added in v1.8.0

func (c *CfgManager) DumpTrace()

DumpTrace dump all configurations

func (*CfgManager) Get added in v1.8.0

Get ...

func (*CfgManager) GetAll added in v1.8.0

func (c *CfgManager) GetAll() map[string]interface{}

GetAll get all settings.

func (*CfgManager) GetDatabaseCfg added in v1.8.0

func (c *CfgManager) GetDatabaseCfg() *models.Database

GetDatabaseCfg - Get database configurations

func (*CfgManager) GetUserCfgs added in v1.8.0

func (c *CfgManager) GetUserCfgs() map[string]interface{}

GetUserCfgs retrieve all user configs

func (*CfgManager) Load added in v1.8.0

func (c *CfgManager) Load() error

Load load configuration from storage, like database or redis

func (*CfgManager) Save added in v1.8.0

func (c *CfgManager) Save() error

Save - Save all current configuration to storage

func (*CfgManager) Set added in v1.8.0

func (c *CfgManager) Set(key string, value interface{})

Set ...

func (*CfgManager) UpdateConfig added in v1.8.0

func (c *CfgManager) UpdateConfig(cfgs map[string]interface{}) error

UpdateConfig - Update config store with a specified configuration and also save updated configure.

func (*CfgManager) ValidateCfg added in v1.8.0

func (c *CfgManager) ValidateCfg(cfgs map[string]interface{}) error

ValidateCfg validate config by metadata. return the first error if exist.

type FileKeyProvider

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

FileKeyProvider reads key from file

func (*FileKeyProvider) Get

func (f *FileKeyProvider) Get(params map[string]interface{}) (string, error)

Get returns the key read from file

type InMemoryDriver added in v1.8.0

type InMemoryDriver struct {
	sync.Mutex
	// contains filtered or unexported fields
}

InMemoryDriver driver for unit testing

func (*InMemoryDriver) Load added in v1.8.0

func (d *InMemoryDriver) Load() (map[string]interface{}, error)

Load load data from driver, for example load from database, it should be invoked before get any user scope config for system scope config, because it is immutable, no need to call this method

func (*InMemoryDriver) Save added in v1.8.0

func (d *InMemoryDriver) Save(cfg map[string]interface{}) error

Save only save user config setting to driver, for example: database, REST

type KeyProvider

type KeyProvider interface {
	// Get returns the key
	// params can be used to pass parameters in different implements
	Get(params map[string]interface{}) (string, error)
}

KeyProvider provides the key used to encrypt and decrypt attrs

func NewFileKeyProvider

func NewFileKeyProvider(path string) KeyProvider

NewFileKeyProvider returns an instance of FileKeyProvider path: where the key should be read from

type PresetKeyProvider added in v1.8.0

type PresetKeyProvider struct {
	Key string
}

PresetKeyProvider returns the preset key disregarding the parm, this is for testing only

func (*PresetKeyProvider) Get added in v1.8.0

func (p *PresetKeyProvider) Get(params map[string]interface{}) (string, error)

Get ...

Directories

Path Synopsis
Package metadata define config related metadata
Package metadata define config related metadata
Package store is only used in the internal implement of manager, not a public api.
Package store is only used in the internal implement of manager, not a public api.
driver
Package driver provide the implementation of config driver used in CfgManager
Package driver provide the implementation of config driver used in CfgManager

Jump to

Keyboard shortcuts

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