feat: allow users to bind to all interfaces when a proxy is enabled

- use a plugin trigger to see whether we should bind to all interfaces
- create a generic way of setting properties for a plugin
- migrate proxy-enabled to the new network property "bind-all-interfaces"
- add network:set subcommand
This commit is contained in:
Jose Diaz-Gonzalez
2017-09-03 20:36:09 -04:00
committed by Michael Hobbs
parent 7a4464a8ae
commit acde3d60a7
19 changed files with 477 additions and 53 deletions

View File

@@ -12,6 +12,16 @@ import (
sh "github.com/codeskyblue/go-sh"
)
// ValidProperties is a map of all valid network properties
var ValidProperties = map[string]bool{
"bind-all-interfaces": true,
}
// DefaultPropertyValues is a map of all valid network properties with corresponding default property values
var DefaultPropertyValues = map[string]string{
"bind-all-interfaces": "false",
}
// BuildConfig builds network config files
func BuildConfig(appName string) {
err := common.VerifyAppName(appName)
@@ -147,6 +157,14 @@ func GetContainerPort(appName string, procType string, isHerokuishContainer bool
return port
}
// GetDefaultValue returns the default value for a given property
func GetDefaultValue(property string) string {
if ValidProperties[property] {
return DefaultPropertyValues[property]
}
return ""
}
// HasNetworkConfig returns whether the network configuration for a given app exists
func HasNetworkConfig(appName string) bool {
appRoot := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName}, "/")