Пример #1
0
func getDefinedValueBool(c *config.Config, section string, key string, target *bool) {
	if c.HasOption(section, key) {
		if bool_value, err := c.Bool(section, key); err == nil {
			*target = bool_value
		}
	}
}
Пример #2
0
func getDefinedValueString(c *config.Config, section string, key string, target *string) {
	if string_value, err := c.String(section, key); err == nil {
		string_value = os.ExpandEnv(string_value)
		*target = string_value
	}

}
Пример #3
0
// writes to target only if has been defined in config
// avoids overwriting of default values if config is not defined
func getDefinedValueInt(c *config.Config, section string, key string, target *int) {
	if c.HasOption(section, key) {
		if int_value, err := c.Int(section, key); err == nil {
			*target = int_value
		}
	}
}