blob: ef34a6074363691e666d178178791ff4bcbaed66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"net/http"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/utils"
)
func TestElasticsearch(cfg *model.Config) *model.AppError {
if *cfg.ElasticSearchSettings.Password == model.FAKE_SETTING {
if *cfg.ElasticSearchSettings.ConnectionUrl == *utils.Cfg.ElasticSearchSettings.ConnectionUrl && *cfg.ElasticSearchSettings.Username == *utils.Cfg.ElasticSearchSettings.Username {
*cfg.ElasticSearchSettings.Password = *utils.Cfg.ElasticSearchSettings.Password
} else {
return model.NewAppError("TestElasticsearch", "ent.elasticsearch.test_config.reenter_password", nil, "", http.StatusBadRequest)
}
}
if esI := einterfaces.GetElasticsearchInterface(); 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
}
|