675643c6 by astaxie

beego: run mode support test

1 parent 4786fb09
...@@ -384,6 +384,7 @@ func initBeforeHttpRun() { ...@@ -384,6 +384,7 @@ func initBeforeHttpRun() {
384 // this function is for test package init 384 // this function is for test package init
385 func TestBeegoInit(apppath string) { 385 func TestBeegoInit(apppath string) {
386 AppPath = apppath 386 AppPath = apppath
387 RunMode = "test"
387 AppConfigPath = filepath.Join(AppPath, "conf", "app.conf") 388 AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
388 err := ParseConfig() 389 err := ParseConfig()
389 if err != nil && !os.IsNotExist(err) { 390 if err != nil && !os.IsNotExist(err) {
......
...@@ -178,7 +178,11 @@ func ParseConfig() (err error) { ...@@ -178,7 +178,11 @@ func ParseConfig() (err error) {
178 AppConfig = config.NewFakeConfig() 178 AppConfig = config.NewFakeConfig()
179 return err 179 return err
180 } else { 180 } else {
181 HttpAddr = AppConfig.String("HttpAddr") 181 if v := AppConfig.String(RunMode + "::HttpAddr"); v != "" {
182 HttpAddr = v
183 } else {
184 HttpAddr = AppConfig.String("HttpAddr")
185 }
182 186
183 if v, err := AppConfig.Int("HttpPort"); err == nil { 187 if v, err := AppConfig.Int("HttpPort"); err == nil {
184 HttpPort = v 188 HttpPort = v
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!