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:
@@ -161,7 +161,7 @@ func getDetectedPortMaps(appName string) []PortMap {
|
||||
// getGlobalProxyPort gets the global proxy port
|
||||
func getGlobalProxyPort() int {
|
||||
port := 0
|
||||
value := common.PropertyGet("ports", "--global", "proxy-port")
|
||||
value := common.PropertyGet("proxy", "--global", "proxy-port")
|
||||
if intVar, err := strconv.Atoi(value); err == nil {
|
||||
port = intVar
|
||||
}
|
||||
@@ -172,7 +172,7 @@ func getGlobalProxyPort() int {
|
||||
// getGlobalProxySSLPort gets the global proxy ssl port
|
||||
func getGlobalProxySSLPort() int {
|
||||
port := 0
|
||||
value := common.PropertyGet("ports", "--global", "proxy-ssl-port")
|
||||
value := common.PropertyGet("proxy", "--global", "proxy-ssl-port")
|
||||
if intVar, err := strconv.Atoi(value); err == nil {
|
||||
port = intVar
|
||||
}
|
||||
@@ -194,7 +194,7 @@ func getPortMaps(appName string) []PortMap {
|
||||
// getProxyPort gets the proxy port for an app
|
||||
func getProxyPort(appName string) int {
|
||||
port := 0
|
||||
value := common.PropertyGet("ports", appName, "proxy-port")
|
||||
value := common.PropertyGet("proxy", appName, "proxy-port")
|
||||
if intVar, err := strconv.Atoi(value); err == nil {
|
||||
port = intVar
|
||||
}
|
||||
@@ -205,7 +205,7 @@ func getProxyPort(appName string) int {
|
||||
// getProxySSLPort gets the proxy ssl port for an app
|
||||
func getProxySSLPort(appName string) int {
|
||||
port := 0
|
||||
value := common.PropertyGet("ports", appName, "proxy-ssl-port")
|
||||
value := common.PropertyGet("proxy", appName, "proxy-ssl-port")
|
||||
if intVar, err := strconv.Atoi(value); err == nil {
|
||||
port = intVar
|
||||
}
|
||||
@@ -432,12 +432,12 @@ func setPortMaps(appName string, portMaps []PortMap) error {
|
||||
|
||||
// setProxyPort sets the proxy port for an app
|
||||
func setProxyPort(appName string, port int) error {
|
||||
return common.PropertyWrite("ports", appName, "proxy-port", fmt.Sprint(port))
|
||||
return common.PropertyWrite("proxy", appName, "proxy-port", fmt.Sprint(port))
|
||||
}
|
||||
|
||||
// setProxySSLPort sets the proxy ssl port for an app
|
||||
func setProxySSLPort(appName string, port int) error {
|
||||
return common.PropertyWrite("ports", appName, "proxy-ssl-port", fmt.Sprint(port))
|
||||
return common.PropertyWrite("proxy", appName, "proxy-ssl-port", fmt.Sprint(port))
|
||||
}
|
||||
|
||||
// transformPortMap normalizes a port map string for migration to list properties
|
||||
|
||||
@@ -4,19 +4,6 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultProperties is a map of all valid ports properties with corresponding default property values
|
||||
DefaultProperties = map[string]string{
|
||||
"proxy-port": "",
|
||||
"proxy-ssl-port": "",
|
||||
}
|
||||
|
||||
// GlobalProperties is a map of all valid global ports properties
|
||||
GlobalProperties = map[string]bool{
|
||||
"proxy-port": true,
|
||||
"proxy-ssl-port": true,
|
||||
}
|
||||
)
|
||||
|
||||
// PortMap is a struct that contains a scheme:host-port:container-port mapping
|
||||
type PortMap struct {
|
||||
|
||||
@@ -21,16 +21,6 @@ func TriggerInstall() error {
|
||||
ListProperty: true,
|
||||
Transform: transformPortMap,
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
@@ -166,7 +156,7 @@ func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error {
|
||||
|
||||
// TriggerPostCertsRemove unsets port properties after SSL cert is removed
|
||||
func TriggerPostCertsRemove(appName string) error {
|
||||
if err := common.PropertyDelete("ports", appName, "proxy-ssl-port"); err != nil {
|
||||
if err := common.PropertyDelete("proxy", appName, "proxy-ssl-port"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -175,15 +165,15 @@ func TriggerPostCertsRemove(appName string) error {
|
||||
|
||||
// TriggerPostCertsUpdate sets port properties after SSL cert is added
|
||||
func TriggerPostCertsUpdate(appName string) error {
|
||||
port := common.PropertyGet("ports", appName, "proxy-port")
|
||||
sslPort := common.PropertyGet("ports", appName, "proxy-ssl-port")
|
||||
port := common.PropertyGet("proxy", appName, "proxy-port")
|
||||
sslPort := common.PropertyGet("proxy", appName, "proxy-ssl-port")
|
||||
portMaps := getPortMaps(appName)
|
||||
|
||||
if port == "80" {
|
||||
common.PropertyDelete("ports", appName, "proxy-port")
|
||||
common.PropertyDelete("proxy", appName, "proxy-port")
|
||||
}
|
||||
if sslPort == "443" {
|
||||
common.PropertyDelete("ports", appName, "proxy-ssl-port")
|
||||
common.PropertyDelete("proxy", appName, "proxy-ssl-port")
|
||||
}
|
||||
|
||||
var http80Ports []PortMap
|
||||
|
||||
Reference in New Issue
Block a user