Skip to content

Commit

Permalink
gittar tree search add depth config
Browse files Browse the repository at this point in the history
  • Loading branch information
kakj-go committed Nov 4, 2021
1 parent 9e31ea8 commit 59bac61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/gittar/api/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ func SearchRepoTree(ctx *webcontext.Context) {
pattern = "*"
}
var depth int64
depth = 5
depth = int64(conf.GitRepoTreeSearchDepth())
commit, err := ctx.Repository.GetCommitByAny(ref)
if err != nil {
ctx.Abort(err)
Expand Down
11 changes: 8 additions & 3 deletions modules/gittar/conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ type Conf struct {
GitGCCronExpression string `env:"GIT_GC_CRON_EXPRESSION" default:"0 0 1 * * ?"`

// ory/kratos config
OryEnabled bool `default:"false" env:"ORY_ENABLED"`
OryKratosAddr string `default:"kratos-public" env:"ORY_KRATOS_ADDR"`
OryKratosPrivateAddr string `default:"kratos-admin" env:"ORY_KRATOS_ADMIN_ADDR"`
OryEnabled bool `default:"false" env:"ORY_ENABLED"`
OryKratosAddr string `default:"kratos-public" env:"ORY_KRATOS_ADDR"`
OryKratosPrivateAddr string `default:"kratos-admin" env:"ORY_KRATOS_ADMIN_ADDR"`
GitRepoTreeSearchDepth int `default:"5" env:"GIT_REPO_TREE_SEARCH_DEPTH"`
}

var cfg Conf
Expand Down Expand Up @@ -190,3 +191,7 @@ func OryCompatibleClientSecret() string {
func OryKratosPrivateAddr() string {
return cfg.OryKratosPrivateAddr
}

func GitRepoTreeSearchDepth() int {
return cfg.GitRepoTreeSearchDepth
}
5 changes: 5 additions & 0 deletions modules/gittar/req.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### tree-search
GET http://localhost:5566/wb/jacoco/xinhua/tree-search?ref=master&pattern=*.workflow
User-ID: 2
Org-ID: 1
Internal-Client: true

0 comments on commit 59bac61

Please sign in to comment.