Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker interface { // Check should return a string of config file path // and just throw a panic if current file not exist Check() string }
Checker is basic interface and should be implemented by any objects that want to check config file path
type ConfigChecker ¶
type ConfigChecker struct {
// contains filtered or unexported fields
}
ConfigChecker used as main struct to explore config file path
func NewConfigChecker ¶
func NewConfigChecker(checkers ...Checker) *ConfigChecker
NewConfigChecker used to create new instance of ConfigChecker
func (*ConfigChecker) Explore ¶
func (cc *ConfigChecker) Explore() (string, error)
Explore used to explore configuration's file from os or default home dir
type ConfigParser ¶
type ConfigParser struct {
// contains filtered or unexported fields
}
ConfigParser used to parse configuration values from given filepath
func NewConfigParser ¶
func NewConfigParser(parser Parser, reader SourceReader) *ConfigParser
NewConfigParser used to create new instance of ConfigParser
func (*ConfigParser) Load ¶
func (cp *ConfigParser) Load(confpath string) (*PluginConfig, error)
Load used to read given config's file, get the content bytes and parse the data
type Host ¶
type Host struct { Name string Config PluginConfig }
Host used as main host's configurations
type Parser ¶
type Parser interface {
Parse(content []byte) (*PluginConfig, error)
}
Parser is an interface to abstract main function to parse toml's file
type PluginConfig ¶
type PluginConfig struct { Meta PluginMeta `toml:"meta"` Settings PluginSettings `toml:"settings"` Plugins map[string]PluginInfo `toml:"plugins"` Hosts map[string]PluginHost `toml:"hosts"` }
PluginConfig used to store all plugin configuration values
type PluginHost ¶
type PluginHost struct {
Plugins []string `toml:"plugins"`
}
PluginHost used to save all registered service's plugins
type PluginInfo ¶
type PluginInfo struct { Author string `toml:"author"` MD5 string `toml:"md5"` Exec string `toml:"exec"` ExecArgs []string `toml:"exec_args"` ExecFile string `toml:"exec_file"` ExecTime int `toml:"exec_time"` ProtocolType string `toml:"comm_type"` }
PluginInfo used to save all plugin's basic informations
type PluginInit ¶
PluginInit used to save initialize states
type PluginMeta ¶
type PluginMeta struct { Version string `toml:"version"` Author string `toml:"author"` Contributors []string `toml:"contributors"` }
PluginMeta used to save all [meta] informations
type PluginSettings ¶
type PluginSettings struct {
Debug bool `toml:"debug"`
}
PluginSettings used to save all global [settings] informations
type SourceReader ¶
SourceReader is an interface to abstract config reader activity