diff --git a/common/config.go b/common/config.go index ee4481e..d9ad84e 100644 --- a/common/config.go +++ b/common/config.go @@ -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) } diff --git a/config_example.xml b/config_example.xml index ea6abd5..fc9f155 100644 --- a/config_example.xml +++ b/config_example.xml @@ -1,6 +1,7 @@
127.0.0.1
+ 80 username diff --git a/nas/main.go b/nas/main.go index 483abe4..44892a4 100644 --- a/nas/main.go +++ b/nas/main.go @@ -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") {