Oops, don't kill Gosora when the Unix socket isn't present.

This commit is contained in:
Azareal 2018-08-29 11:59:43 +10:00
parent 63451c7291
commit c20251b462

View File

@ -57,13 +57,11 @@ func (adapter *MysqlAdapter) BuildConn(config map[string]string) (*sql.DB, error
} }
db, err := sql.Open("mysql", config["username"]+dbpassword+"@unix("+dbsocket+")/"+config["name"]+"?collation="+dbCollation+"&parseTime=true") db, err := sql.Open("mysql", config["username"]+dbpassword+"@unix("+dbsocket+")/"+config["name"]+"?collation="+dbCollation+"&parseTime=true")
if err != nil { if err == nil {
return db, err
}
// Make sure that the connection is alive // Make sure that the connection is alive
return db, db.Ping() return db, db.Ping()
} }
}
// Open the database connection // Open the database connection
db, err := sql.Open("mysql", config["username"]+dbpassword+"@tcp("+config["host"]+":"+config["port"]+")/"+config["name"]+"?collation="+dbCollation+"&parseTime=true") db, err := sql.Open("mysql", config["username"]+dbpassword+"@tcp("+config["host"]+":"+config["port"]+")/"+config["name"]+"?collation="+dbCollation+"&parseTime=true")