Skip to content

Commit

Permalink
fix overwrite bug
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Apr 23, 2024
1 parent 2b6a020 commit 8bd69b6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,14 @@ func OverwriteWithCustomConfig(configFilePath string, sectionKeyValues []Section
} else if configMap[currentSection] != nil {
// If the line is in a section that needs to be overwritten, check each key
for key, value := range configMap[currentSection] {
// If the line contains the key, overwrite the line with the new key-value pair
if strings.Contains(line, key) {
// Split the line into key and value parts
parts := strings.SplitN(line, "=", 2)
if len(parts) != 2 {
continue
}
// Trim spaces and compare the key part with the target key
if strings.TrimSpace(parts[0]) == key {
// If the keys match, overwrite the line with the new key-value pair
line = key + " = " + value
break
}
Expand Down

0 comments on commit 8bd69b6

Please sign in to comment.