diff --git a/config/config.go b/config/config.go index bd275d7..3adcff8 100644 --- a/config/config.go +++ b/config/config.go @@ -230,6 +230,10 @@ func ParseRawProxyBackendHostURLMap(raw string) (map[string]url.URL, error) { // returning the mapping and error (if any) func ParseRawShardRoutingBackendHostURLMap(raw string) (map[string]IntervalURLMap, error) { parsed := make(map[string]IntervalURLMap) + // allow empty shard map (enabled but unused) + if raw == "" { + return parsed, nil + } hostConfigs := strings.Split(raw, ",") for _, hc := range hostConfigs { pieces := strings.Split(hc, ">") diff --git a/config/validate_test.go b/config/validate_test.go index ee60bbc..38d9df5 100644 --- a/config/validate_test.go +++ b/config/validate_test.go @@ -92,6 +92,11 @@ func TestUnitTestValidateConfigReturnsErrorIfInvaidShardRoutingBackendURLMap(t * err := config.Validate(testConfig) assert.NotNil(t, err) + + // allow empty + testConfig.ProxyShardBackendHostURLMapRaw = "" + err = config.Validate(testConfig) + assert.NoError(t, err) } func TestUnitTestValidateConfigReturnsErrorIfInvalidProxyServicePort(t *testing.T) {