mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
modify elastic urls from string to array.
This commit is contained in:
parent
72f9d7f047
commit
719dc43af1
|
@ -176,7 +176,11 @@ database = "seaweedfs"
|
||||||
|
|
||||||
[elastic7]
|
[elastic7]
|
||||||
enabled = false
|
enabled = false
|
||||||
servers = "http://localhost1:9200,http://localhost2:9200,http://localhost3:9200"
|
servers = [
|
||||||
|
"http://localhost1:9200",
|
||||||
|
"http://localhost2:9200",
|
||||||
|
"http://localhost3:9200",
|
||||||
|
]
|
||||||
username = ""
|
username = ""
|
||||||
password = ""
|
password = ""
|
||||||
sniff_enabled = false
|
sniff_enabled = false
|
||||||
|
|
|
@ -68,13 +68,8 @@ func (store *ElasticStore) Initialize(configuration weed_util.Configuration, pre
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *ElasticStore) initialize(configuration weed_util.Configuration, prefix string) (options []elastic.ClientOptionFunc) {
|
func (store *ElasticStore) initialize(configuration weed_util.Configuration, prefix string) (options []elastic.ClientOptionFunc) {
|
||||||
configuration.SetDefault(prefix+"servers", "http://localhost:9200")
|
servers := configuration.GetStringSlice(prefix + "servers")
|
||||||
servers := configuration.GetString(prefix + "servers")
|
options = append(options, elastic.SetURL(servers...))
|
||||||
url := make([]string, 0)
|
|
||||||
for _, v := range strings.Split(servers, ",") {
|
|
||||||
url = append(url, v)
|
|
||||||
}
|
|
||||||
options = append(options, elastic.SetURL(url...))
|
|
||||||
username := configuration.GetString(prefix + "username")
|
username := configuration.GetString(prefix + "username")
|
||||||
password := configuration.GetString(prefix + "password")
|
password := configuration.GetString(prefix + "password")
|
||||||
if username != "" && password != "" {
|
if username != "" && password != "" {
|
||||||
|
|
Loading…
Reference in a new issue