Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(option string) (result, found bool)
- func BoolDefault(option string, dfault bool) bool
- func HasConfigInit() bool
- func HasSection(section string) bool
- func InitModule() error
- func InitModuleByParams(filename string) error
- func Int(option string) (result int, found bool)
- func IntDefault(option string, dfault int) int
- func Options(prefix string) []string
- func SetOption(name, value string)
- func SetSection(section string)
- func String(option string) (result string, found bool)
- func StringDefault(option, dfault string) string
- type IConfig
- type MergedConfig
- func (c *MergedConfig) Bool(option string) (result, found bool)
- func (c *MergedConfig) BoolDefault(option string, dfault bool) bool
- func (c *MergedConfig) HasSection(section string) bool
- func (c *MergedConfig) Int(option string) (result int, found bool)
- func (c *MergedConfig) IntDefault(option string, dfault int) int
- func (c *MergedConfig) Options(prefix string) []string
- func (c *MergedConfig) Raw() *config.Config
- func (c *MergedConfig) SetOption(name, value string)
- func (c *MergedConfig) SetSection(section string)
- func (c *MergedConfig) String(option string) (result string, found bool)
- func (c *MergedConfig) StringDefault(option, dfault string) string
Constants ¶
View Source
const CONFIGPREFIX = "config="
Variables ¶
View Source
var ConfPath string
Functions ¶
func BoolDefault ¶
func HasConfigInit ¶
func HasConfigInit() bool
func HasSection ¶
func InitModule ¶
func InitModule() error
func InitModuleByParams ¶
func IntDefault ¶
func SetSection ¶
func SetSection(section string)
func StringDefault ¶
Types ¶
type IConfig ¶
type IConfig interface { SetSection(section string) SetOption(name, value string) Int(option string) (result int, found bool) IntDefault(option string, dfault int) int Bool(option string) (result, found bool) BoolDefault(option string, dfault bool) bool String(option string) (result string, found bool) StringDefault(option, dfault string) string HasSection(section string) bool Options(prefix string) []string }
type MergedConfig ¶
type MergedConfig struct {
// contains filtered or unexported fields
}
This handles the parsing of app.conf It has a "preferred" section that is checked first for option queries. If the preferred section does not have the option, the DEFAULT section is checked fallback.
var Config *MergedConfig
func LoadConfig ¶
func LoadConfig(confName string) (*MergedConfig, error)
func NewEmptyConfig ¶
func NewEmptyConfig() *MergedConfig
func (*MergedConfig) Bool ¶
func (c *MergedConfig) Bool(option string) (result, found bool)
func (*MergedConfig) BoolDefault ¶
func (c *MergedConfig) BoolDefault(option string, dfault bool) bool
func (*MergedConfig) HasSection ¶
func (c *MergedConfig) HasSection(section string) bool
func (*MergedConfig) IntDefault ¶
func (c *MergedConfig) IntDefault(option string, dfault int) int
func (*MergedConfig) Options ¶
func (c *MergedConfig) Options(prefix string) []string
Options returns all configuration option keys. If a prefix is provided, then that is applied as a filter.
func (*MergedConfig) Raw ¶
func (c *MergedConfig) Raw() *config.Config
func (*MergedConfig) SetOption ¶
func (c *MergedConfig) SetOption(name, value string)
func (*MergedConfig) SetSection ¶
func (c *MergedConfig) SetSection(section string)
func (*MergedConfig) String ¶
func (c *MergedConfig) String(option string) (result string, found bool)
func (*MergedConfig) StringDefault ¶
func (c *MergedConfig) StringDefault(option, dfault string) string
Click to show internal directories.
Click to hide internal directories.