mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* app.UpdateConfig method * test fix * another test fix * the config override option as-was is just error prone, remove it for now * derp
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package app
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/mattermost/mattermost-server/model"
|
|
)
|
|
|
|
func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError {
|
|
if *cfg.ElasticsearchSettings.Password == model.FAKE_SETTING {
|
|
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)
|
|
}
|
|
}
|
|
|
|
if esI := a.Elasticsearch; esI != nil {
|
|
if err := esI.TestConfig(cfg); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
err := model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (a *App) PurgeElasticsearchIndexes() *model.AppError {
|
|
if esI := a.Elasticsearch; esI != nil {
|
|
if err := esI.PurgeIndexes(); err != nil {
|
|
return err
|
|
}
|
|
} else {
|
|
err := model.NewAppError("PurgeElasticsearchIndexes", "ent.elasticsearch.test_config.license.error", nil, "", http.StatusNotImplemented)
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|