Skip to content
Open
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
20 changes: 20 additions & 0 deletions convert/plugin_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package convert

import (
"fmt"
"strconv"
"strings"

"github.com/kong/go-database-reconciler/pkg/cprint"
Expand Down Expand Up @@ -188,6 +189,25 @@ func updateLegacyFieldToNewField(pluginConfig kong.Configuration,
return pluginConfig
}

if newField == "redis.sentinel_nodes" {
rawList, _ := value.([]interface{})
var newIpPort []map[string]interface{}
for _, item := range rawList {
if entry, ok := item.(string); ok {
parts := strings.Split(entry, ":")
if len(parts) == 2 {
// 3. Convert the port string to an integer
portInt, _ := strconv.Atoi(parts[1])
newIpPort = append(newIpPort, map[string]interface{}{
"host": parts[0],
"port": portInt,
})
}
}
}
value = newIpPort
}

// Remove the old field
delete(current, oldKey)

Expand Down