summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-08 23:51:50 +0800
committerGitHub <noreply@github.com>2022-05-08 17:51:50 +0200
commitd4834071da9ce010fd4677ef339c598dd23dc130 (patch)
treeee6692b9b44e259d79158c2dc2b867d8f3286630 /modules
parent6a969681cd862bf153fa7921485278be1e8a092a (diff)
downloadgitea-d4834071da9ce010fd4677ef339c598dd23dc130.tar.gz
gitea-d4834071da9ce010fd4677ef339c598dd23dc130.zip
Repository level enable package or disable (#19323)
Diffstat (limited to 'modules')
-rw-r--r--modules/context/repo.go1
-rw-r--r--modules/setting/repository.go4
2 files changed, 5 insertions, 0 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 4a1e9aa9e8..3dc8e51392 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -1019,6 +1019,7 @@ func UnitTypes() func(ctx *Context) {
ctx.Data["UnitTypeExternalWiki"] = unit_model.TypeExternalWiki
ctx.Data["UnitTypeExternalTracker"] = unit_model.TypeExternalTracker
ctx.Data["UnitTypeProjects"] = unit_model.TypeProjects
+ ctx.Data["UnitTypePackages"] = unit_model.TypePackages
}
}
diff --git a/modules/setting/repository.go b/modules/setting/repository.go
index 96b37f6980..f24bc841d6 100644
--- a/modules/setting/repository.go
+++ b/modules/setting/repository.go
@@ -295,6 +295,10 @@ func newRepository() {
log.Fatal("Failed to map Repository.PullRequest settings: %v", err)
}
+ if !Cfg.Section("packages").Key("ENABLED").MustBool(false) {
+ Repository.DisabledRepoUnits = append(Repository.DisabledRepoUnits, "repo.packages")
+ }
+
// Handle default trustmodel settings
Repository.Signing.DefaultTrustModel = strings.ToLower(strings.TrimSpace(Repository.Signing.DefaultTrustModel))
if Repository.Signing.DefaultTrustModel == "default" {