Update config to have port

This commit is contained in:
Sketch
2023-11-04 21:44:16 -04:00
parent 5851701312
commit 5b11946f74
3 changed files with 5 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ package common
import (
"encoding/xml"
"io/ioutil"
"os"
)
type Config struct {
@@ -11,10 +11,11 @@ type Config struct {
DatabaseAddress string `xml:"databaseAddress"`
DatabaseName string `xml:"databaseName"`
Address string `xml:"address"`
Port string `xml:"nasPort"`
}
func GetConfig() Config {
data, err := ioutil.ReadFile("config.xml")
data, err := os.ReadFile("config.xml")
if err != nil {
panic(err)
}

View File

@@ -1,6 +1,7 @@
<Config>
<!-- The address the server will bind to -->
<address>127.0.0.1</address>
<nasPort>80</nasPort>
<!-- Database Credentials -->
<username>username</username>

View File

@@ -32,7 +32,7 @@ func StartServer() {
}
// Finally, initialize the HTTP server
address := config.Address
address := config.Address + ":" + config.Port
r := NewRoute()
ac := r.HandleGroup("ac")
{