Ver Fonte

Able to use `GOGS_WORK_DIR` environment variable to specify work directory

Unknwon há 9 anos atrás
pai
commit
32c12d553c
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      modules/setting/setting.go

+ 5 - 0
modules/setting/setting.go

@@ -201,6 +201,11 @@ func ExecPath() (string, error) {
 
 // WorkDir returns absolute path of work directory.
 func WorkDir() (string, error) {
+	wd := os.Getenv("GOGS_WORK_DIR")
+	if len(wd) > 0 {
+		return wd, nil
+	}
+
 	execPath, err := ExecPath()
 	if err != nil {
 		return execPath, err