1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-23 02:24:13 +00:00

beego: run mode support test

This commit is contained in:
astaxie 2014-06-10 22:47:48 +08:00
parent 4786fb0948
commit 675643c68d
2 changed files with 6 additions and 1 deletions

View File

@ -384,6 +384,7 @@ func initBeforeHttpRun() {
// this function is for test package init
func TestBeegoInit(apppath string) {
AppPath = apppath
RunMode = "test"
AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
err := ParseConfig()
if err != nil && !os.IsNotExist(err) {

View File

@ -178,7 +178,11 @@ func ParseConfig() (err error) {
AppConfig = config.NewFakeConfig()
return err
} else {
HttpAddr = AppConfig.String("HttpAddr")
if v := AppConfig.String(RunMode + "::HttpAddr"); v != "" {
HttpAddr = v
} else {
HttpAddr = AppConfig.String("HttpAddr")
}
if v, err := AppConfig.Int("HttpPort"); err == nil {
HttpPort = v