diff --git a/config.json b/config.json deleted file mode 100644 index 31af0b7..0000000 --- a/config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "SQLUser":"username", - "SQLPass":"password", - "Port":"2018" -} \ No newline at end of file diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..2f7fda7 --- /dev/null +++ b/config.xml @@ -0,0 +1,5 @@ + + uwu + owo + nou + \ No newline at end of file diff --git a/main.go b/main.go index 5b0fb1b..f4d2ba6 100644 --- a/main.go +++ b/main.go @@ -19,13 +19,13 @@ package main import ( "bytes" - "encoding/json" "encoding/xml" "fmt" _ "github.com/go-sql-driver/mysql" "io/ioutil" "log" "net/http" + "os" "strconv" "time" ) @@ -37,8 +37,6 @@ const ( Header = `` + "\n" ) -var configs []Config - // CheckError makes error handling not as ugly and inefficient. func CheckError(e error) { if e != nil { @@ -47,12 +45,16 @@ func CheckError(e error) { } func main() { - configblob, err := ioutil.ReadFile("config.json") - CheckError(err) - err = json.Unmarshal(configblob, &configs) - CheckError(err) fmt.Println("Open SOAP-GO for Server Environments.") + fmt.Println("Reading the Config...") + configfile, err := os.Open("./config.xml") + CheckError(err) + ioconfig, err := ioutil.ReadAll(configfile) + CheckError(err) + err = xml.Unmarshal(ioconfig, &Config{}) + fmt.Println(Config{}) + CheckError(err) fmt.Println("Initializing core...") fmt.Println("Starting HTTP connection (Port 2018)...") diff --git a/structure.go b/structure.go index 75dec73..d2932de 100644 --- a/structure.go +++ b/structure.go @@ -25,9 +25,10 @@ import "encoding/xml" // The structures may seem repetitive and redundant, but blame WSC's inconsistent SOAP requests. type Config struct { - SQLUser string - SQLPass string - Port string + XMLName xml.Name `xml:"SOAP-GO-WSC_Config"` + SQLUser string `xml:"SQLUser"` + SQLPass string `xml:"SQLPass"` + Port string `xml:"Port"` } // CheckDeviceStatus