func getErrorMessage(responce zhash.Hash) string { var errText string errorMessage, _ := responce.GetStringSlice("error") for _, e := range errorMessage { errText += e } if errText == "" { errText = responce.String() } return errText }
// SetConfig from zhash.Hash instance which actually is representation of // map[string]interface{} // SetConfig validates specified configuration before using. func (server *Server) SetConfig(config zhash.Hash) error { isMaster, err := config.GetBool("master") if err != nil && !zhash.IsNotFound(err) { return err } if isMaster { slaves, err := config.GetStringSlice("slaves") if err != nil && !zhash.IsNotFound(err) { return err } if len(slaves) == 0 { logger.Warning("slave servers is not specified") } else { _, err = config.GetInt("timeout") if err != nil { return err } } } _, err = config.GetString("storage") if err != nil { return err } _, err = config.GetString("http", "listen") if err != nil { return err } server.config = config return nil }