mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 01:00:54 +00:00
decouple httplib from config
This commit is contained in:
parent
463e96447a
commit
dd3f1ce9be
@ -16,8 +16,6 @@ package testing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/astaxie/beego/pkg/client/httplib"
|
"github.com/astaxie/beego/pkg/client/httplib"
|
||||||
|
|
||||||
"github.com/astaxie/beego/pkg/infrastructure/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var port = ""
|
var port = ""
|
||||||
@ -28,16 +26,13 @@ type TestHTTPRequest struct {
|
|||||||
httplib.BeegoHTTPRequest
|
httplib.BeegoHTTPRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetTestingPort(p string) {
|
||||||
|
port = p
|
||||||
|
}
|
||||||
|
|
||||||
func getPort() string {
|
func getPort() string {
|
||||||
if port == "" {
|
if port == "" {
|
||||||
config, err := config.NewConfig("ini", "../conf/app.conf")
|
port = "8080"
|
||||||
if err != nil {
|
|
||||||
return "8080"
|
|
||||||
}
|
|
||||||
port, err = config.String(nil, "httpport")
|
|
||||||
if err != nil {
|
|
||||||
return "8080"
|
|
||||||
}
|
|
||||||
return port
|
return port
|
||||||
}
|
}
|
||||||
return port
|
return port
|
||||||
|
Loading…
Reference in New Issue
Block a user