Absolute path for setting.CustomConf
This commit is contained in:
parent
e9b1b908ee
commit
23d0735f90
1 changed files with 12 additions and 6 deletions
|
@ -60,15 +60,21 @@ func TestMain(m *testing.M) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initIntegrationTest() {
|
func initIntegrationTest() {
|
||||||
if setting.CustomConf = os.Getenv("GITEA_CONF"); setting.CustomConf == "" {
|
giteaRoot := os.Getenv("GITEA_ROOT")
|
||||||
fmt.Println("Environment variable $GITEA_CONF not set")
|
if giteaRoot == "" {
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
if giteaRoot := os.Getenv("GITEA_ROOT"); giteaRoot == "" {
|
|
||||||
fmt.Println("Environment variable $GITEA_ROOT not set")
|
fmt.Println("Environment variable $GITEA_ROOT not set")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
} else {
|
}
|
||||||
setting.AppPath = path.Join(giteaRoot, "gitea")
|
setting.AppPath = path.Join(giteaRoot, "gitea")
|
||||||
|
|
||||||
|
giteaConf := os.Getenv("GITEA_CONF")
|
||||||
|
if giteaConf == "" {
|
||||||
|
fmt.Println("Environment variable $GITEA_CONF not set")
|
||||||
|
os.Exit(1)
|
||||||
|
} else if !path.IsAbs(giteaConf) {
|
||||||
|
setting.CustomConf = path.Join(giteaRoot, giteaConf)
|
||||||
|
} else {
|
||||||
|
setting.CustomConf = giteaConf
|
||||||
}
|
}
|
||||||
|
|
||||||
setting.NewContext()
|
setting.NewContext()
|
||||||
|
|
Reference in a new issue