mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-27 05:15:47 +00:00
handle param values that aren't from loading in JSON
This commit is contained in:
@@ -33,13 +33,16 @@ func init() {
|
|||||||
|
|
||||||
port, ok := params["port"]
|
port, ok := params["port"]
|
||||||
if ok {
|
if ok {
|
||||||
|
specificportNum, ok := port.(int)
|
||||||
specificportNum, ok := port.(float64)
|
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("net.udp.server port must be a number")
|
specificportNum, ok := port.(float64)
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("nats.server port must be a number")
|
||||||
}
|
}
|
||||||
portNum = int(specificportNum)
|
portNum = int(specificportNum)
|
||||||
|
} else {
|
||||||
|
portNum = int(specificportNum)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ipString := "0.0.0.0"
|
ipString := "0.0.0.0"
|
||||||
@@ -50,7 +53,7 @@ func init() {
|
|||||||
specificIpString, ok := ip.(string)
|
specificIpString, ok := ip.(string)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("net.udp.server ip must be a string")
|
return nil, errors.New("nats.server ip must be a string")
|
||||||
}
|
}
|
||||||
ipString = specificIpString
|
ipString = specificIpString
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user