fix(admin): read int values from YAML for port fields
This commit is contained in:
parent
64ddd71358
commit
9edd6f1038
1 changed files with 10 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package admin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
|
|
@ -132,8 +133,15 @@ func getNested(m map[string]interface{}, keys ...string) string {
|
|||
}
|
||||
v = mp[k]
|
||||
if i == len(keys)-1 {
|
||||
s, _ := v.(string)
|
||||
return s
|
||||
switch val := v.(type) {
|
||||
case string:
|
||||
return val
|
||||
case int:
|
||||
return fmt.Sprintf("%d", val)
|
||||
case float64:
|
||||
return fmt.Sprintf("%.0f", val)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue