- Add stripQuotes utility function in utils.go to avoid code duplication - Apply quote removal in both read.go and write.go for complete coverage - Fix issue where IFACES and other config values appeared with quotes in web UI - Ensures compatibility with quoted environment variables from docker-compose - Prevents quotes from being re-added during YAML serialization Resolves issue where configuration values from environment variables were displayed with quotes in the web interface and could be re-saved with quotes.
14 lines
No EOL
355 B
Go
14 lines
No EOL
355 B
Go
package conf
|
|
|
|
import "strings"
|
|
|
|
// stripQuotes removes surrounding quotes from a string value
|
|
func stripQuotes(value string) string {
|
|
if len(value) >= 2 {
|
|
if (strings.HasPrefix(value, `"`) && strings.HasSuffix(value, `"`)) ||
|
|
(strings.HasPrefix(value, `'`) && strings.HasSuffix(value, `'`)) {
|
|
return value[1 : len(value)-1]
|
|
}
|
|
}
|
|
return value
|
|
} |