Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.8 KiB
Go
59 lines
1.8 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
|
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
|
)
|
|
|
|
func (a *App) TestElasticsearch(rctx request.CTX, cfg *model.Config) *model.AppError {
|
|
if *cfg.ElasticsearchSettings.Password == model.FakeSetting {
|
|
if *cfg.ElasticsearchSettings.ConnectionURL == *a.Config().ElasticsearchSettings.ConnectionURL && *cfg.ElasticsearchSettings.Username == *a.Config().ElasticsearchSettings.Username {
|
|
*cfg.ElasticsearchSettings.Password = *a.Config().ElasticsearchSettings.Password
|
|
} else {
|
|
return model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.reenter_password", nil, "", http.StatusBadRequest)
|
|
}
|
|
}
|
|
|
|
seI := a.SearchEngine().ElasticsearchEngine
|
|
if seI == nil {
|
|
err := model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
|
return err
|
|
}
|
|
if err := seI.TestConfig(rctx, cfg); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (a *App) SetSearchEngine(se *searchengine.Broker) {
|
|
a.ch.srv.platform.SearchEngine = se
|
|
}
|
|
|
|
func (a *App) PurgeElasticsearchIndexes(rctx request.CTX, indexes []string) *model.AppError {
|
|
engine := a.SearchEngine().ElasticsearchEngine
|
|
if engine == nil {
|
|
err := model.NewAppError("PurgeElasticsearchIndexes", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
|
return err
|
|
}
|
|
|
|
var appErr *model.AppError
|
|
if len(indexes) > 0 {
|
|
appErr = engine.PurgeIndexList(rctx, indexes)
|
|
} else {
|
|
appErr = engine.PurgeIndexes(rctx)
|
|
}
|
|
|
|
return appErr
|
|
}
|
|
|
|
func (a *App) ActiveSearchBackend() string {
|
|
return a.ch.srv.platform.SearchEngine.ActiveEngine()
|
|
}
|