Skip to content

Commit b7bd86e

Browse files
kakj-goerda-bot
authored andcommitted
gittar tree search add depth config (erda-project#2872)
1 parent f36bf2d commit b7bd86e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

modules/gittar/api/repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ func SearchRepoTree(ctx *webcontext.Context) {
840840
pattern = "*"
841841
}
842842
var depth int64
843-
depth = 5
843+
depth = conf.GitRepoTreeSearchDepth()
844844
commit, err := ctx.Repository.GetCommitByAny(ref)
845845
if err != nil {
846846
ctx.Abort(err)

modules/gittar/conf/conf.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ type Conf struct {
5050
GitGCCronExpression string `env:"GIT_GC_CRON_EXPRESSION" default:"0 0 1 * * ?"`
5151

5252
// ory/kratos config
53-
OryEnabled bool `default:"false" env:"ORY_ENABLED"`
54-
OryKratosAddr string `default:"kratos-public" env:"ORY_KRATOS_ADDR"`
55-
OryKratosPrivateAddr string `default:"kratos-admin" env:"ORY_KRATOS_ADMIN_ADDR"`
53+
OryEnabled bool `default:"false" env:"ORY_ENABLED"`
54+
OryKratosAddr string `default:"kratos-public" env:"ORY_KRATOS_ADDR"`
55+
OryKratosPrivateAddr string `default:"kratos-admin" env:"ORY_KRATOS_ADMIN_ADDR"`
56+
GitRepoTreeSearchDepth int64 `default:"5" env:"GIT_REPO_TREE_SEARCH_DEPTH"`
5657
}
5758

5859
var cfg Conf
@@ -190,3 +191,7 @@ func OryCompatibleClientSecret() string {
190191
func OryKratosPrivateAddr() string {
191192
return cfg.OryKratosPrivateAddr
192193
}
194+
195+
func GitRepoTreeSearchDepth() int64 {
196+
return cfg.GitRepoTreeSearchDepth
197+
}

0 commit comments

Comments
 (0)