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:
@@ -1,8 +1,6 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
"github.com/dokku/dokku/plugins/config"
|
||||
)
|
||||
@@ -11,22 +9,6 @@ import (
|
||||
// and defaults to -1 (false)
|
||||
const RunInSerial = 0
|
||||
|
||||
// PortMap is a struct that contains a scheme:host-port:container-port mapping
|
||||
type PortMap struct {
|
||||
ContainerPort int
|
||||
HostPort int
|
||||
Scheme string
|
||||
}
|
||||
|
||||
func (p PortMap) String() string {
|
||||
return fmt.Sprintf("%s:%d:%d", p.Scheme, p.HostPort, p.ContainerPort)
|
||||
}
|
||||
|
||||
// AllowsPersistence returns true if the port map is not to be persisted
|
||||
func (p PortMap) AllowsPersistence() bool {
|
||||
return p.Scheme == "__internal__"
|
||||
}
|
||||
|
||||
// BuildConfig rebuilds the proxy config for the specified app
|
||||
func BuildConfig(appName string) error {
|
||||
return common.PlugnTrigger("proxy-build-config", []string{appName}...)
|
||||
|
||||
Reference in New Issue
Block a user