diff --git a/main.go b/main.go index ac30762..5f3cd42 100644 --- a/main.go +++ b/main.go @@ -105,7 +105,7 @@ var configOptions = map[string][]string{ InfluxMeasurement: {"power"}, MySqlDSN: {"-"}, MySqlTable: {"home_power"}, - IdentFilter: {""}, + IdentFilter: {"-"}, } func getUserHome() string { diff --git a/samler.go b/samler.go index 6cc12c0..ecdf568 100644 --- a/samler.go +++ b/samler.go @@ -74,14 +74,14 @@ func toFilterList(identFilter string) []string { count := 0 for i, v := range rawIdentFilterList { tmpIdentFilterList[i] = strings.TrimSpace(v) - if len(tmpIdentFilterList[i]) > 0 { + if len(tmpIdentFilterList[i]) > 0 && tmpIdentFilterList[i] != "-" { count += 1 } } identFilterList := make([]string, count) i := 0 for _, v := range tmpIdentFilterList { - if len(v) > 0 { + if len(v) > 0 && v != "-" { identFilterList[i] = v i += 1 } diff --git a/samler_test.go b/samler_test.go index caf4f46..18df35e 100644 --- a/samler_test.go +++ b/samler_test.go @@ -99,10 +99,10 @@ func TestFailedSending(t *testing.T) { func TestToEmptyFilterList(t *testing.T) { // Given - empties := []string{"", " ", ",", " , , "} + empties := []string{"-", "", " ", ",", " , , "} // When - mapped := [4][]string{} + mapped := [5][]string{} for i, v := range empties { mapped[i] = toFilterList(v) }