diff options
Diffstat (limited to 'modules/setting/indexer.go')
-rw-r--r-- | modules/setting/indexer.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go index 5b10018eb7..8aee8596de 100644 --- a/modules/setting/indexer.go +++ b/modules/setting/indexer.go @@ -4,6 +4,7 @@ package setting import ( + "net/url" "path/filepath" "strings" "time" @@ -18,6 +19,7 @@ var Indexer = struct { IssueType string IssuePath string IssueConnStr string + IssueConnAuth string IssueIndexerName string StartupTimeout time.Duration @@ -34,6 +36,7 @@ var Indexer = struct { IssueType: "bleve", IssuePath: "indexers/issues.bleve", IssueConnStr: "", + IssueConnAuth: "", IssueIndexerName: "gitea_issues", RepoIndexerEnabled: false, @@ -53,6 +56,18 @@ func loadIndexerFrom(rootCfg ConfigProvider) { Indexer.IssuePath = filepath.ToSlash(filepath.Join(AppWorkPath, Indexer.IssuePath)) } Indexer.IssueConnStr = sec.Key("ISSUE_INDEXER_CONN_STR").MustString(Indexer.IssueConnStr) + + if Indexer.IssueType == "meilisearch" { + u, err := url.Parse(Indexer.IssueConnStr) + if err != nil { + log.Warn("Failed to parse ISSUE_INDEXER_CONN_STR: %v", err) + u = &url.URL{} + } + Indexer.IssueConnAuth, _ = u.User.Password() + u.User = nil + Indexer.IssueConnStr = u.String() + } + Indexer.IssueIndexerName = sec.Key("ISSUE_INDEXER_NAME").MustString(Indexer.IssueIndexerName) // The following settings are deprecated and can be overridden by settings in [queue] or [queue.issue_indexer] |