Skip to content

Commit 7da7968

Browse files
authored
fix lighthouse.calculated_remotes parsing (#1438)
This was broken with the change to yaml.v3: - #1148 We forgot to update these references to `map[string]any`. Without this fix, Nebula crashes with an error like this: {"error":"config `lighthouse.calculated_remotes` has invalid type: map[string]interface {}","level":"error","msg":"Invalid lighthouse.calculated_remotes","time":"2025-07-29T15:50:06.479499Z"}
1 parent 91eff03 commit 7da7968

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

calculated_remote.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,11 @@ func NewCalculatedRemotesFromConfig(c *config.C, k string) (*bart.Table[[]*calcu
8484

8585
calculatedRemotes := new(bart.Table[[]*calculatedRemote])
8686

87-
rawMap, ok := value.(map[any]any)
87+
rawMap, ok := value.(map[string]any)
8888
if !ok {
8989
return nil, fmt.Errorf("config `%s` has invalid type: %T", k, value)
9090
}
91-
for rawKey, rawValue := range rawMap {
92-
rawCIDR, ok := rawKey.(string)
93-
if !ok {
94-
return nil, fmt.Errorf("config `%s` has invalid key (type %T): %v", k, rawKey, rawKey)
95-
}
96-
91+
for rawCIDR, rawValue := range rawMap {
9792
cidr, err := netip.ParsePrefix(rawCIDR)
9893
if err != nil {
9994
return nil, fmt.Errorf("config `%s` has invalid CIDR: %s", k, rawCIDR)
@@ -129,7 +124,7 @@ func newCalculatedRemotesListFromConfig(cidr netip.Prefix, raw any) ([]*calculat
129124
}
130125

131126
func newCalculatedRemotesEntryFromConfig(cidr netip.Prefix, raw any) (*calculatedRemote, error) {
132-
rawMap, ok := raw.(map[any]any)
127+
rawMap, ok := raw.(map[string]any)
133128
if !ok {
134129
return nil, fmt.Errorf("invalid type: %T", raw)
135130
}

0 commit comments

Comments
 (0)