Merge pull request #3014 from dokku/dockerfile-network-ports

fix: handle case where DOKKU_DOCKERFILE_PORTS is an empty string
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2017-12-17 00:56:48 -05:00
commit fa605b6a83
1 file changed
+5 -1
@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"unicode/utf8"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/config" "github.com/dokku/dokku/plugins/config"
@@ -23,7 +24,10 @@ func main() {
var dockerfilePorts []string var dockerfilePorts []string
if !isHerokuishContainer { if !isHerokuishContainer {
dockerfilePorts = strings.Split(config.GetWithDefault(appName, "DOKKU_DOCKERFILE_PORTS", ""), " ") dokkuDockerfilePorts := strings.Trim(config.GetWithDefault(appName, "DOKKU_DOCKERFILE_PORTS", ""), " ")
if utf8.RuneCountInString(dokkuDockerfilePorts) > 0 {
dockerfilePorts = strings.Split(dokkuDockerfilePorts, " ")
}
} }
var ports []string var ports []string