mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-05 21:11:02 +02:00
no need to export this
This commit is contained in:
parent
c6427795ef
commit
e578d6e4d2
14
main.go
14
main.go
@ -38,8 +38,8 @@ const (
|
|||||||
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
|
Header = `<?xml version="1.0" encoding="UTF-8"?>` + "\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckError makes error handling not as ugly and inefficient.
|
// checkError makes error handling not as ugly and inefficient.
|
||||||
func CheckError(err error) {
|
func checkError(err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("WiiSOAP forgot how to drive and suddenly crashed! Reason: %s\n", err.Error())
|
log.Fatalf("WiiSOAP forgot how to drive and suddenly crashed! Reason: %s\n", err.Error())
|
||||||
}
|
}
|
||||||
@ -51,24 +51,24 @@ func main() {
|
|||||||
|
|
||||||
// Check the Config.
|
// Check the Config.
|
||||||
configfile, err := os.Open("./config.xml")
|
configfile, err := os.Open("./config.xml")
|
||||||
CheckError(err)
|
checkError(err)
|
||||||
ioconfig, err := ioutil.ReadAll(configfile)
|
ioconfig, err := ioutil.ReadAll(configfile)
|
||||||
CheckError(err)
|
checkError(err)
|
||||||
CON := Config{}
|
CON := Config{}
|
||||||
err = xml.Unmarshal([]byte(ioconfig), &CON)
|
err = xml.Unmarshal([]byte(ioconfig), &CON)
|
||||||
fmt.Println(CON)
|
fmt.Println(CON)
|
||||||
CheckError(err)
|
checkError(err)
|
||||||
|
|
||||||
fmt.Println("Initializing core...")
|
fmt.Println("Initializing core...")
|
||||||
|
|
||||||
// Start SQL.
|
// Start SQL.
|
||||||
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s)", CON.SQLUser, CON.SQLPass, CON.SQLAddress, CON.SQLDB))
|
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s)", CON.SQLUser, CON.SQLPass, CON.SQLAddress, CON.SQLDB))
|
||||||
CheckError(err)
|
checkError(err)
|
||||||
|
|
||||||
// Close SQL after everything else is done.
|
// Close SQL after everything else is done.
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
err = db.Ping()
|
err = db.Ping()
|
||||||
CheckError(err)
|
checkError(err)
|
||||||
|
|
||||||
// Start the HTTP server.
|
// Start the HTTP server.
|
||||||
fmt.Printf("Starting HTTP connection (%s)...\nNot using the usual port for HTTP?\nBe sure to use a proxy, otherwise the Wii can't connect!\n", CON.Address)
|
fmt.Printf("Starting HTTP connection (%s)...\nNot using the usual port for HTTP?\nBe sure to use a proxy, otherwise the Wii can't connect!\n", CON.Address)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user