Skip to content

Commit

Permalink
turns out it can be in64 or float64
Browse files Browse the repository at this point in the history
  • Loading branch information
codepope committed Sep 7, 2020
1 parent d523113 commit ea215a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flyctl/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,18 @@ func (ac *AppConfig) SetInternalPort(port int) bool {
}

func (ac *AppConfig) GetInternalPort() (int, error) {
services, ok := ac.Definition["services"].([]map[string]interface{})
services, ok := ac.Definition["services"].([]interface{})
if ok {
service0 := services[0] //.(map[string]interface{})
service0 := services[0].(map[string]interface{})
internalport, ok := service0["internal_port"].(int64)
if ok {
return int(internalport), nil
}
internalportfloat, ok := service0["internal_port"].(float64)
if ok {
return int(internalportfloat), nil
}
}

return -1, errors.New("could not find internal port setting")
}

Expand Down

0 comments on commit ea215a8

Please sign in to comment.