eureka.go: add bool config option type to parser, fix logic for multilinestring
This commit is contained in:
parent
645dd26393
commit
e3f0edeb58
1 changed files with 7 additions and 2 deletions
|
@ -321,7 +321,7 @@ func (self *EurekaAdapter) readCfg() error {
|
||||||
v := strings.TrimSpace(strings.Join(tokens[1:], " "))
|
v := strings.TrimSpace(strings.Join(tokens[1:], " "))
|
||||||
|
|
||||||
if strings.Contains(v, "\"") {
|
if strings.Contains(v, "\"") {
|
||||||
if strings.Contains(v, "\\\r\n") || strings.Contains(v, "\\\n") {
|
if strings.HasSuffix(k, "_HTML") {
|
||||||
// process multiline string
|
// process multiline string
|
||||||
lines := strings.Split(v, "\n")
|
lines := strings.Split(v, "\n")
|
||||||
cleanedString := ""
|
cleanedString := ""
|
||||||
|
@ -363,9 +363,13 @@ func (self *EurekaAdapter) readCfg() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
cfgType := "int"
|
||||||
|
if strings.HasPrefix(k, "IS_") {
|
||||||
|
cfgType = "bool"
|
||||||
|
}
|
||||||
self.Config[ConfigOption{
|
self.Config[ConfigOption{
|
||||||
Name: k,
|
Name: k,
|
||||||
Type: "int",
|
Type: cfgType,
|
||||||
}] = v
|
}] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,6 +387,7 @@ func (self *EurekaAdapter) writeCfg() error {
|
||||||
for k, v := range self.Config {
|
for k, v := range self.Config {
|
||||||
switch k.Type {
|
switch k.Type {
|
||||||
case "int":
|
case "int":
|
||||||
|
case "bool":
|
||||||
_, err := strconv.ParseInt(v, 10, 64)
|
_, err := strconv.ParseInt(v, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue