fix: update docs and emit deprecation error for old config key

This commit is contained in:
Nirmal N R
2026-04-01 18:47:05 +05:30
parent 1be114188d
commit d2d211031b
4 changed files with 89 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
@@ -35,9 +36,11 @@ func (d dediRegistryProvider) New(ctx context.Context, config map[string]string)
}
}
if rawNetworkIDs, exists := config["allowedNetworkIDs"]; exists && rawNetworkIDs != "" {
dediConfig.AllowedNetworkIDs = parseAllowedNetworkIDs(rawNetworkIDs)
allowedNetworkIDs, err := resolveAllowedNetworkIDs(ctx, config)
if err != nil {
return nil, nil, err
}
dediConfig.AllowedNetworkIDs = allowedNetworkIDs
log.Debugf(ctx, "DeDi Registry config mapped: %+v", dediConfig)
@@ -64,5 +67,19 @@ func parseAllowedNetworkIDs(raw string) []string {
return networkIDs
}
func resolveAllowedNetworkIDs(ctx context.Context, config map[string]string) ([]string, error) {
if rawParentNamespaces, exists := config["allowedParentNamespaces"]; exists && rawParentNamespaces != "" {
if _, hasAllowedNetworkIDs := config["allowedNetworkIDs"]; !hasAllowedNetworkIDs {
return nil, fmt.Errorf("config key 'allowedParentNamespaces' is no longer supported; use 'allowedNetworkIDs' with full network IDs")
}
}
if rawNetworkIDs, exists := config["allowedNetworkIDs"]; exists && rawNetworkIDs != "" {
return parseAllowedNetworkIDs(rawNetworkIDs), nil
}
return nil, nil
}
// Provider is the exported plugin instance
var Provider = dediRegistryProvider{}