mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-05 21:11:02 +02:00
*pulls config card*
This commit is contained in:
parent
0bc9b8026b
commit
7f53288b37
16
core.go
16
core.go
@ -1,16 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"database/sql"
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
|
||||||
"log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func StartSQL() {
|
|
||||||
db, err := sql.Open("mysql",
|
|
||||||
":"+"@tcp(127.0.0.1:3306)/hello")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
defer db.Close()
|
|
||||||
}
|
|
20
main.go
20
main.go
@ -19,6 +19,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"database/sql"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
@ -46,23 +47,30 @@ func CheckError(e error) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
fmt.Println("WiiSOAP 0.2 Kawauso")
|
fmt.Println("WiiSOAP 0.2.1 Kawauso")
|
||||||
fmt.Println("Reading the Config...")
|
fmt.Println("Reading 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)
|
||||||
Config := Config{}
|
CON := Config{}
|
||||||
err = xml.Unmarshal([]byte(ioconfig), &Config)
|
err = xml.Unmarshal([]byte(ioconfig), &CON)
|
||||||
fmt.Println(Config)
|
fmt.Println(CON)
|
||||||
CheckError(err)
|
CheckError(err)
|
||||||
|
|
||||||
fmt.Println("Initializing core...")
|
fmt.Println("Initializing core...")
|
||||||
|
|
||||||
fmt.Println("Starting HTTP connection (Port 2018)...")
|
// Start SQL.
|
||||||
|
db, err := sql.Open("mysql",
|
||||||
|
CON.SQLUser+":"+CON.SQLPass+"@tcp(127.0.0.1:3306)/hello")
|
||||||
|
CheckError(err)
|
||||||
|
defer db.Close()
|
||||||
|
|
||||||
|
fmt.Println("Starting HTTP connection (" + CON.Port + ")...")
|
||||||
fmt.Println("NOTICE: The SOAP Server runs under a port that doesn't work with WSC naturally.")
|
fmt.Println("NOTICE: The SOAP Server runs under a port that doesn't work with WSC naturally.")
|
||||||
fmt.Println("You can either use proxying from Nginx (recommended) or another web server software, or edit this script to use port 80.")
|
fmt.Println("You can either use proxying from Nginx (recommended) or another web server software, or edit this script to use port 80.")
|
||||||
http.HandleFunc("/", handler) // each request calls handler
|
http.HandleFunc("/", handler) // each request calls handler
|
||||||
log.Fatal(http.ListenAndServe(":2018", nil))
|
log.Fatal(http.ListenAndServe(CON.Port, nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user