aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorThibault Meyer <0xbaadf00d@users.noreply.github.com>2016-12-22 07:42:04 +0100
committer无闻 <u@gogs.io>2016-12-22 01:42:04 -0500
commitc47fbc629bec5b4c213ddff24e96c20ed8f4ca74 (patch)
tree25f404cf44674c090fca73ae46dda9d6dfc5ee1b /modules
parentd04b19545db513c31d86d503046f51ba780e4038 (diff)
Feature #2583: Disable HTTP cloning (#3667)
* Can disable GIT interactions by HTTP protocol * rename variable + fix wiki link * missing space
Diffstat (limited to 'modules')
-rw-r--r--modules/context/repo.go1
-rw-r--r--modules/setting/setting.go2
2 files changed, 3 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index f078523e..b3d483df 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -256,6 +256,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
ctx.Data["IsRepositoryWriter"] = ctx.Repo.IsWriter()
ctx.Data["DisableSSH"] = setting.SSH.Disabled
+ ctx.Data["DisableHTTP"] = setting.Repository.DisableHTTPGit
ctx.Data["CloneLink"] = repo.CloneLink()
ctx.Data["WikiCloneLink"] = repo.WikiCloneLink()
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index e7202b01..ea76e6c4 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -118,6 +118,7 @@ var (
MirrorQueueLength int
PullRequestQueueLength int
PreferredLicenses []string
+ DisableHTTPGit bool
// Repository editor settings
Editor struct {
@@ -494,6 +495,7 @@ func NewContext() {
// Determine and create root git repository path.
sec = Cfg.Section("repository")
+ Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool()
RepoRootPath = sec.Key("ROOT").MustString(path.Join(homeDir, "gogs-repositories"))
forcePathSeparator(RepoRootPath)
if !filepath.IsAbs(RepoRootPath) {