Esempio n. 1
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
}