From aa5f077f786fe4f7e2bc7c30f1ac8c2dfe2640fe Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 20 May 2015 10:37:45 +0300 Subject: [PATCH] allow to specify WorkDir via env var Signed-off-by: Vasiliy Tolstov --- modules/setting/setting.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index aefc3520f..beb2233a7 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -162,8 +162,12 @@ func ExecPath() (string, error) { // WorkDir returns absolute path of work directory. func WorkDir() (string, error) { - execPath, err := ExecPath() - return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err + work := os.Getenv("WORK_DIR") + if len(work) == 0 { + execPath, err := ExecPath() + return path.Dir(strings.Replace(execPath, "\\", "/", -1)), err + } + return work, nil } func forcePathSeparator(path string) {