eureka.go: add bool config option type to parser, fix logic for multilinestring

This commit is contained in:
Iris Lightshard 2023-01-12 22:43:44 -07:00
parent 645dd26393
commit e3f0edeb58
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -321,7 +321,7 @@ func (self *EurekaAdapter) readCfg() error {
v := strings.TrimSpace(strings.Join(tokens[1:], " "))
if strings.Contains(v, "\"") {
if strings.Contains(v, "\\\r\n") || strings.Contains(v, "\\\n") {
if strings.HasSuffix(k, "_HTML") {
// process multiline string
lines := strings.Split(v, "\n")
cleanedString := ""
@ -363,9 +363,13 @@ func (self *EurekaAdapter) readCfg() error {
if err != nil {
return err
}
cfgType := "int"
if strings.HasPrefix(k, "IS_") {
cfgType = "bool"
}
self.Config[ConfigOption{
Name: k,
Type: "int",
Type: cfgType,
}] = v
}
}
@ -383,6 +387,7 @@ func (self *EurekaAdapter) writeCfg() error {
for k, v := range self.Config {
switch k.Type {
case "int":
case "bool":
_, err := strconv.ParseInt(v, 10, 64)
if err != nil {
return err