From faba0d7273c3a714bf19774d3de3a9d0bdc30ed8 Mon Sep 17 00:00:00 2001 From: ysqi Date: Mon, 19 Sep 2016 18:38:56 +0800 Subject: [PATCH] Support load app config before test Beego --- beego.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beego.go b/beego.go index 10304994..613e9199 100644 --- a/beego.go +++ b/beego.go @@ -85,8 +85,13 @@ func initBeforeHTTPRun() { // TestBeegoInit is for test package init func TestBeegoInit(ap string) { - appConfigPath = filepath.Join(ap, "conf", "app.conf") + path := filepath.Join(ap, "conf", "app.conf") os.Chdir(ap) + InitBeegoBeforeTest(path) +} + +// InitBeegoBeforeTest is for test package init +func InitBeegoBeforeTest(appConfigPath string) { if err := LoadAppConfig(appConfigProvider, appConfigPath); err != nil { panic(err) }