diff --git a/internal/config/config.go b/internal/config/config.go index 06fb3e2b..dbbe544a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3,7 +3,6 @@ package config import ( "errors" "os" - "strings" "go.uber.org/zap" "gopkg.in/yaml.v3" @@ -104,8 +103,8 @@ type MethodsConfig struct { func (m *MethodsConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { type MethodsConfigString struct { - Enabled string - Disabled string + Enabled []string + Disabled []string } var methodsConfigString MethodsConfigString @@ -116,12 +115,12 @@ func (m *MethodsConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { } m.Enabled = make(map[string]bool) - for _, method := range strings.Split(methodsConfigString.Enabled, ",") { + for _, method := range methodsConfigString.Enabled { m.Enabled[method] = true } m.Disabled = make(map[string]bool) - for _, method := range strings.Split(methodsConfigString.Disabled, ",") { + for _, method := range methodsConfigString.Disabled { m.Disabled[method] = true } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index ecfb20c3..24714e60 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -203,8 +203,11 @@ func TestParseConfig_ValidConfig(t *testing.T) { group: primary nodeType: full methods: - enabled: eth_getStorageAt - disabled: eth_getBalance,getLogs + enabled: + - eth_getStorageAt + disabled: + - eth_getBalance + - getLogs - id: ankr-polygon httpURL: "https://rpc.ankr.com/polygon" wsURL: "wss://rpc.ankr.com/polygon/ws/${ANKR_API_KEY}"