Documentation ¶
Index ¶
- Variables
- func AddOption(section, key, value string)
- func Get(key string) string
- func GetOption(section, key string) string
- func GetOrDefault(key, deflt string) string
- func GetSection(section string) map[string]string
- func GetSections() []string
- func Initialize() (err error)
- func InitializeClient() (err error)
- func Remove(key string)
- func RemoveOption(section, key string)
- func RemoveSection(section string)
- func Save() (err error)
- func Set(key, value string)
- type Config
- func (c *Config) AddOption(section, key, value string)
- func (c *Config) Get(key string) string
- func (c *Config) GetOption(section, key string) (value string)
- func (c *Config) GetOrDefault(key, deflt string) string
- func (c *Config) GetSection(section string) map[string]string
- func (c *Config) GetSections() []string
- func (c *Config) Remove(key string)
- func (c *Config) RemoveOption(section, key string)
- func (c *Config) RemoveSection(section string)
- func (c *Config) Save() (err error)
- func (c *Config) Set(key, value string)
Constants ¶
This section is empty.
Variables ¶
var Debug bool
The global debug flag
var ErrNotInitialized = errors.New("the configuration was not initialized")
Error is paniked if the global configuration was not initialized.
var RootDir string
The root directory of cloudway installation.
Functions ¶
func AddOption ¶
func AddOption(section, key, value string)
AddOption add a configuration value into the given section.
func GetOrDefault ¶
GetOrDefault get a configuration value, if no such value configured then the default value is returned.
func GetSection ¶
GetSection get section in the configuration file.
func GetSections ¶
func GetSections() []string
GetSections returns the list of sections in the configuration.
func InitializeClient ¶
func InitializeClient() (err error)
Initialize the client configuration file.
func RemoveOption ¶
func RemoveOption(section, key string)
RemoveOption removes a configuration value from the given section.
func RemoveSection ¶
func RemoveSection(section string)
RemoveSection remove a section from configuration.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetOrDefault ¶
GetOrDefault get a configuration value, if no such value configured then the default value is returned.
func (*Config) GetSection ¶
GetSection get a section in the configuration file.
func (*Config) GetSections ¶
GetSections returns the list of sections in the configuration.
func (*Config) RemoveOption ¶
RemoveFrom removes a configuration value from the given section.
func (*Config) RemoveSection ¶
RemoveSection remove a section from configuration.