fix: move proxy-port properties to proxy plugin and fix CI failures
- Move proxy-port and proxy-ssl-port properties from ports plugin to proxy plugin where they conceptually belong - Generalize proxy:set to handle any property (matching ps:set pattern) instead of only handling the type property - Fix apps:set --global flag parsing (pflag treats --global as a flag, not an argument — must be defined explicitly like ps:set does) - Add missing property-functions source to scheduler-docker-local shell scripts (scheduler-enter, scheduler-run, scheduler-deploy, check-deploy, bin/scheduler-deploy-process-container) - Update nginx-vhosts property references from ports to proxy plugin - Update tests to use proxy:set for proxy-port properties
This commit is contained in:
@@ -11,13 +11,17 @@ const RunInSerial = 0
|
||||
var (
|
||||
// DefaultProperties is a map of all valid proxy properties with corresponding default property values
|
||||
DefaultProperties = map[string]string{
|
||||
"disabled": "false",
|
||||
"type": "",
|
||||
"disabled": "false",
|
||||
"proxy-port": "",
|
||||
"proxy-ssl-port": "",
|
||||
"type": "",
|
||||
}
|
||||
|
||||
// GlobalProperties is a map of all valid global proxy properties
|
||||
GlobalProperties = map[string]bool{
|
||||
"type": true,
|
||||
"proxy-port": true,
|
||||
"proxy-ssl-port": true,
|
||||
"type": true,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -59,12 +59,14 @@ func main() {
|
||||
global := args.Bool("global", false, "--global: set a global property")
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
proxyType := args.Arg(1)
|
||||
property := args.Arg(1)
|
||||
value := args.Arg(2)
|
||||
if *global {
|
||||
appName = "--global"
|
||||
proxyType = args.Arg(0)
|
||||
property = args.Arg(0)
|
||||
value = args.Arg(1)
|
||||
}
|
||||
err = proxy.CommandSet(appName, proxyType)
|
||||
err = proxy.CommandSet(appName, property, value)
|
||||
default:
|
||||
err = fmt.Errorf("Invalid plugin subcommand call: %s", subcommand)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package proxy
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
@@ -82,22 +81,7 @@ func CommandReport(appName string, format string, infoFlag string) error {
|
||||
}
|
||||
|
||||
// CommandSet sets a proxy for an app
|
||||
func CommandSet(appName string, proxyType string) error {
|
||||
if appName != "--global" {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(proxyType) < 2 {
|
||||
return errors.New("Please specify a proxy type")
|
||||
}
|
||||
|
||||
if strings.Contains(proxyType, ":") {
|
||||
common.LogWarn("Detected potential port mapping instead of proxy type")
|
||||
return errors.New("Consider using ports:set command or specifying a valid proxy")
|
||||
}
|
||||
|
||||
common.CommandPropertySet("proxy", appName, "type", proxyType, DefaultProperties, GlobalProperties)
|
||||
func CommandSet(appName string, property string, value string) error {
|
||||
common.CommandPropertySet("proxy", appName, property, value, DefaultProperties, GlobalProperties)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -28,6 +28,16 @@ func TriggerInstall() error {
|
||||
return value
|
||||
},
|
||||
},
|
||||
{
|
||||
ConfigVar: "DOKKU_PROXY_PORT",
|
||||
GlobalConfigVar: "DOKKU_PROXY_PORT",
|
||||
Property: "proxy-port",
|
||||
},
|
||||
{
|
||||
ConfigVar: "DOKKU_PROXY_SSL_PORT",
|
||||
GlobalConfigVar: "DOKKU_PROXY_SSL_PORT",
|
||||
Property: "proxy-ssl-port",
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user