Documentation ¶
Index ¶
- type CfgManager
- func (c *CfgManager) DumpTrace()
- func (c *CfgManager) Get(key string) *metadata.ConfigureValue
- func (c *CfgManager) GetAll() map[string]interface{}
- func (c *CfgManager) GetDatabaseCfg() *models.Database
- func (c *CfgManager) GetUserCfgs() map[string]interface{}
- func (c *CfgManager) Load() error
- func (c *CfgManager) Save() error
- func (c *CfgManager) Set(key string, value interface{})
- func (c *CfgManager) UpdateConfig(cfgs map[string]interface{}) error
- func (c *CfgManager) ValidateCfg(cfgs map[string]interface{}) error
- type FileKeyProvider
- type InMemoryDriver
- type KeyProvider
- type PresetKeyProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CfgManager ¶
type CfgManager struct {
// contains filtered or unexported fields
}
CfgManager ... Configure Manager
func NewDBCfgManager ¶
func NewDBCfgManager() *CfgManager
NewDBCfgManager - create DB config manager
func NewInMemoryManager ¶
func NewInMemoryManager() *CfgManager
NewInMemoryManager create a manager for unit testing, doesn't involve database or REST
func NewRESTCfgManager ¶
func NewRESTCfgManager(configURL, secret string) *CfgManager
NewRESTCfgManager - create REST config manager
func (*CfgManager) GetAll ¶
func (c *CfgManager) GetAll() map[string]interface{}
GetAll get all settings.
func (*CfgManager) GetDatabaseCfg ¶
func (c *CfgManager) GetDatabaseCfg() *models.Database
GetDatabaseCfg - Get database configurations
func (*CfgManager) GetUserCfgs ¶
func (c *CfgManager) GetUserCfgs() map[string]interface{}
GetUserCfgs retrieve all user configs
func (*CfgManager) Load ¶
func (c *CfgManager) Load() error
Load load configuration from storage, like database or redis
func (*CfgManager) Save ¶
func (c *CfgManager) Save() error
Save - Save all current configuration to storage
func (*CfgManager) UpdateConfig ¶
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 ¶
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
type InMemoryDriver ¶
InMemoryDriver driver for unit testing
func (*InMemoryDriver) Load ¶
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 ¶
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 ¶
type PresetKeyProvider struct {
Key string
}
PresetKeyProvider returns the preset key disregarding the parm, this is for testing only
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 |