Exemplo n.º 1
0
func LoadOptionsFromConfig(MergedConfig *revel.MergedConfig) *map[string]string {

	var options = make(map[string]string)

	for _, optionName := range MergedConfig.Options("") {
		optionValue, _ := MergedConfig.String(optionName)
		if optionName == "" || optionValue == "" {
			continue
		}
		options[optionName] = optionValue
	}
	return &options
}
Exemplo n.º 2
0
func NewServerFromConfig(MergedConfig *revel.MergedConfig) *Server {

	var server = Server{
		Username: MergedConfig.StringDefault("username", ""),
		Host:     MergedConfig.StringDefault("host", ""),
		Port:     MergedConfig.StringDefault("port", ""),
	}
	server.SetQueryInterval(MergedConfig.IntDefault("query_interval", 60))
	server.ParsePrivateKey(MergedConfig.StringDefault("private_key", ""))

	if password, isKeyPresent := MergedConfig.String("password"); isKeyPresent {
		server.SetPassword(password)
	}
	return &server
}