diff options
author | Sandro Santilli <strk@kbt.io> | 2016-11-07 11:41:50 +0100 |
---|---|---|
committer | Sandro Santilli <strk@kbt.io> | 2016-11-07 16:05:18 +0100 |
commit | b7263f31a5a0a4a0ac8fe92c83563d7b7dcf7423 (patch) | |
tree | 782bbf98af42c4ffb3d8c38dc787911706d1390e /modules | |
parent | 1b962bac0bb00d6ce2bfd29fdeb1f95301e17b98 (diff) | |
download | gitea-b7263f31a5a0a4a0ac8fe92c83563d7b7dcf7423.tar.gz gitea-b7263f31a5a0a4a0ac8fe92c83563d7b7dcf7423.zip |
Replace GOGS with GITEA in variable names
Still use GOGS_WORK_DIR and GOGS_CUSTOM env variables
as a fallback if the equivalent GITEA_* are not set,
warning user about the need for change.
Does not change "gogs" to "gitea" in webhook type name
Because "gogs" hook type is part of the API (routes) and used
in templates...
Closes #87
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/setting.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 923c45674c..1ddbf6d2bc 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -297,10 +297,18 @@ func init() { // WorkDir returns absolute path of work directory. func WorkDir() (string, error) { - wd := os.Getenv("GOGS_WORK_DIR") + wd := os.Getenv("GITEA_WORK_DIR") if len(wd) > 0 { return wd, nil } + // Use GOGS_WORK_DIR if available, for backward compatibility + // TODO: drop in 1.1.0 ? + wd = os.Getenv("GOGS_WORK_DIR") + if len(wd) > 0 { + log.Warn(`Usage of GOGS_WORK_DIR is deprecated and will be *removed* in a future release, +please consider changing to GITEA_WORK_DIR`) + return wd, nil + } i := strings.LastIndex(AppPath, "/") if i == -1 { @@ -341,9 +349,17 @@ func NewContext() { log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err) } - CustomPath = os.Getenv("GOGS_CUSTOM") + CustomPath = os.Getenv("GITEA_CUSTOM") if len(CustomPath) == 0 { - CustomPath = workDir + "/custom" + // For backward compatibility + // TODO: drop in 1.1.0 ? + CustomPath = os.Getenv("GOGS_CUSTOM") + if len(CustomPath) == 0 { + CustomPath = workDir + "/custom" + } else { + log.Warn(`Usage of GOGS_CUSTOM is deprecated and will be *removed* in a future release, +please consider changing to GITEA_CUSTOM`) + } } if len(CustomConf) == 0 { |