mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 10:01:28 +00:00
beego: run mode support test
This commit is contained in:
parent
4786fb0948
commit
675643c68d
1
beego.go
1
beego.go
@ -384,6 +384,7 @@ func initBeforeHttpRun() {
|
|||||||
// this function is for test package init
|
// this function is for test package init
|
||||||
func TestBeegoInit(apppath string) {
|
func TestBeegoInit(apppath string) {
|
||||||
AppPath = apppath
|
AppPath = apppath
|
||||||
|
RunMode = "test"
|
||||||
AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
AppConfigPath = filepath.Join(AppPath, "conf", "app.conf")
|
||||||
err := ParseConfig()
|
err := ParseConfig()
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
|
@ -177,8 +177,12 @@ func ParseConfig() (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
AppConfig = config.NewFakeConfig()
|
AppConfig = config.NewFakeConfig()
|
||||||
return err
|
return err
|
||||||
|
} else {
|
||||||
|
if v := AppConfig.String(RunMode + "::HttpAddr"); v != "" {
|
||||||
|
HttpAddr = v
|
||||||
} else {
|
} else {
|
||||||
HttpAddr = AppConfig.String("HttpAddr")
|
HttpAddr = AppConfig.String("HttpAddr")
|
||||||
|
}
|
||||||
|
|
||||||
if v, err := AppConfig.Int("HttpPort"); err == nil {
|
if v, err := AppConfig.Int("HttpPort"); err == nil {
|
||||||
HttpPort = v
|
HttpPort = v
|
||||||
|
Loading…
Reference in New Issue
Block a user