Skip to content

Commit 1b6c7ad

Browse files
karlpokusblack-adder
authored andcommittedJan 28, 2019
Let cassandra servers contain whitespace in config (#1301)
1 parent 9069325 commit 1b6c7ad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed
 

‎plugin/storage/cassandra/options.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (cfg *namespaceConfig) initFromViper(v *viper.Viper) {
216216
cfg.MaxRetryAttempts = v.GetInt(cfg.namespace + suffixMaxRetryAttempts)
217217
cfg.Timeout = v.GetDuration(cfg.namespace + suffixTimeout)
218218
cfg.ReconnectInterval = v.GetDuration(cfg.namespace + suffixReconnectInterval)
219-
cfg.servers = v.GetString(cfg.namespace + suffixServers)
219+
cfg.servers = stripWhiteSpace(v.GetString(cfg.namespace + suffixServers))
220220
cfg.Port = v.GetInt(cfg.namespace + suffixPort)
221221
cfg.Keyspace = v.GetString(cfg.namespace + suffixKeyspace)
222222
cfg.LocalDC = v.GetString(cfg.namespace + suffixDC)
@@ -256,3 +256,8 @@ func (opt *Options) Get(namespace string) *config.Configuration {
256256
nsCfg.Servers = strings.Split(nsCfg.servers, ",")
257257
return &nsCfg.Configuration
258258
}
259+
260+
// stripWhiteSpace removes all whitespace characters from a string
261+
func stripWhiteSpace(str string) string {
262+
return strings.Replace(str, " ", "", -1)
263+
}

‎plugin/storage/cassandra/options_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestOptionsWithFlags(t *testing.T) {
5050
command.ParseFlags([]string{
5151
"--cas.keyspace=jaeger",
5252
"--cas.local-dc=mojave",
53-
"--cas.servers=1.1.1.1,2.2.2.2",
53+
"--cas.servers=1.1.1.1, 2.2.2.2",
5454
"--cas.connections-per-host=42",
5555
"--cas.reconnect-interval=42s",
5656
"--cas.max-retry-attempts=42",
@@ -62,7 +62,7 @@ func TestOptionsWithFlags(t *testing.T) {
6262
// enable aux with a couple overrides
6363
"--cas-aux.enabled=true",
6464
"--cas-aux.keyspace=jaeger-archive",
65-
"--cas-aux.servers=3.3.3.3,4.4.4.4",
65+
"--cas-aux.servers=3.3.3.3, 4.4.4.4",
6666
})
6767
opts.InitFromViper(v)
6868

0 commit comments

Comments
 (0)
Please sign in to comment.