Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigDir() string
- type Config
- type ConfigMap
- func (cm *ConfigMap) Byte() ([]byte, error)
- func (cm *ConfigMap) Get(field string) interface{}
- func (cm *ConfigMap) GetSchema(key string) (*FieldSchema, error)
- func (cm *ConfigMap) GetString(field string) string
- func (cm ConfigMap) Map() map[string]interface{}
- func (cm *ConfigMap) Reset(field string) error
- func (cm *ConfigMap) Set(field string, val interface{}) error
- type FieldSchema
Constants ¶
View Source
const ( // Config Files Names ConfigFileName = "config.yml" StateFileName = "state.yml" // RC File Names SpaceRCFileName = ".wospacerc" WorkspaceFileName = ".worc" // UserConfigDir Env WO_CONFIG_DIR = "WO_CONFIG_DIR" XDG_CONFIG_HOME = "XDG_CONFIG_HOME" APP_DATA = "AppData" // WoConfigDir WoXDGConfigDir = "wo" WoAppDataDir = "Wo CLI" WoHomeDir = ".wo" )
Variables ¶
View Source
var ( ErrConfigMapFieldNotFound = "field value not found" ErrConfigMapInvalidFieldAddr = "invalid field addr" ErrConfigValidation = "%s validation err: %s" )
View Source
var ( // Global Config for schemas ConfigGlobalSchema = []FieldSchema{ { Key: "last_scan_editor", Description: "the last editor scan time", Rules: []validation.Rule{}, DefaultValue: 0, }, authSchema, defaultsSchema, editorsSchema, spacesSchema, } // Schema of spaceRC (.wospace) SpaceRCSchema = []FieldSchema{ defaultsSchema, actionsSchema, flowsSchema, cyclesSchema, } // Schema of workspaceRC (.worc) WorkspaceRCSchema = []FieldSchema{ { Key: "name", Description: "", DefaultValue: "", }, { Key: "description", Description: "", DefaultValue: "", }, { Key: "version", Description: "", DefaultValue: "v0.1", }, actionsSchema, flowsSchema, cyclesSchema, appsSchema, } )
Functions ¶
Types ¶
type Config ¶
type Config interface { Get(string) interface{} GetString(string) string Set(string, interface{}) error UnSet(string) error Reset() Write() error Map() map[string]interface{} }
func NewBlankConfig ¶
func NewGlobalConfig ¶
type ConfigMap ¶
type ConfigMap struct {
// contains filtered or unexported fields
}
func NewConfigMap ¶
func NewConfigMap(root map[string]interface{}, schema []FieldSchema) *ConfigMap
type FieldSchema ¶
type FieldSchema struct { Key string Description string Rules []validation.Rule DefaultValue interface{} }
Click to show internal directories.
Click to hide internal directories.