Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package config
import (
"errors"
"os"
"strings"

"go.uber.org/zap"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down
7 changes: 5 additions & 2 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down