Skip to content

Commit 5f9d8f1

Browse files
committed
gittar tree search add depth config
1 parent 9e31ea8 commit 5f9d8f1

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 = int64(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 int `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() int {
196+
return cfg.GitRepoTreeSearchDepth
197+
}

0 commit comments

Comments
 (0)