refactor: move all port management code to standalone ports plugin
This change makes interacting with port mappings more clear - folks might previously set the port mapping to the proxy type or vice-versa. The existing proxy:ports* commands still exist but will show a deprecation warning for a single minor release.
This commit is contained in:
@@ -22,11 +22,6 @@ Additional commands:`
|
||||
proxy:clear-config [--all|<app>], Clears config for a given app
|
||||
proxy:disable <app>, Disable proxy for app
|
||||
proxy:enable <app>, Enable proxy for app
|
||||
proxy:ports <app>, List proxy port mappings for app
|
||||
proxy:ports-add <app> [<scheme>:<host-port>:<container-port>...], Add proxy port mappings to an app
|
||||
proxy:ports-clear <app>, Clear all proxy port mappings for an app
|
||||
proxy:ports-remove <app> [<host-port>|<scheme>:<host-port>:<container-port>...], Remove specific proxy port mappings from an app
|
||||
proxy:ports-set <app> [<scheme>:<host-port>:<container-port>...], Set proxy port mappings for an app
|
||||
proxy:report [<app>] [<flag>], Displays a proxy report for one or more apps
|
||||
proxy:set <app> <proxy-type>, Set proxy type for app
|
||||
`
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
"github.com/dokku/dokku/plugins/ports"
|
||||
"github.com/dokku/dokku/plugins/proxy"
|
||||
|
||||
flag "github.com/spf13/pflag"
|
||||
@@ -49,30 +50,35 @@ func main() {
|
||||
args := flag.NewFlagSet("proxy:ports", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
err = proxy.CommandPorts(appName)
|
||||
common.LogWarn("Deprecated: Use 'ports:list' instead")
|
||||
err = ports.CommandList(appName)
|
||||
case "ports-add":
|
||||
args := flag.NewFlagSet("proxy:ports-add", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
_, portMaps := common.ShiftString(args.Args())
|
||||
err = proxy.CommandPortsAdd(appName, portMaps)
|
||||
common.LogWarn("Deprecated: Use 'ports:add' instead")
|
||||
err = ports.CommandAdd(appName, portMaps)
|
||||
case "ports-clear":
|
||||
args := flag.NewFlagSet("proxy:ports-clear", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
err = proxy.CommandPortsClear(appName)
|
||||
common.LogWarn("Deprecated: Use 'ports:clear' instead")
|
||||
err = ports.CommandClear(appName)
|
||||
case "ports-remove":
|
||||
args := flag.NewFlagSet("proxy:ports-remove", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
_, portMaps := common.ShiftString(args.Args())
|
||||
err = proxy.CommandPortsRemove(appName, portMaps)
|
||||
common.LogWarn("Deprecated: Use 'ports:remove' instead")
|
||||
err = ports.CommandRemove(appName, portMaps)
|
||||
case "ports-set":
|
||||
args := flag.NewFlagSet("proxy:ports-set", flag.ExitOnError)
|
||||
args.Parse(os.Args[2:])
|
||||
appName := args.Arg(0)
|
||||
_, portMaps := common.ShiftString(args.Args())
|
||||
err = proxy.CommandPortsSet(appName, portMaps)
|
||||
common.LogWarn("Deprecated: Use 'ports:set' instead")
|
||||
err = ports.CommandSet(appName, portMaps)
|
||||
case "report":
|
||||
args := flag.NewFlagSet("proxy:report", flag.ExitOnError)
|
||||
format := args.String("format", "stdout", "format: [ stdout | json ]")
|
||||
|
||||
@@ -24,12 +24,6 @@ func main() {
|
||||
case "proxy-type":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.TriggerProxyType(appName)
|
||||
case "post-certs-remove":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.TriggerPostCertsRemove(appName)
|
||||
case "post-certs-update":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.TriggerPostCertsUpdate(appName)
|
||||
case "report":
|
||||
appName := flag.Arg(0)
|
||||
err = proxy.ReportSingleApp(appName, "", "")
|
||||
|
||||
Reference in New Issue
Block a user