refactor: use ports-get plugn trigger for fetching port mappings
This removes use of ports internals from other plugins, which will make it easier to refactor the underlying property storage.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
SUBCOMMANDS = subcommands/list subcommands/add subcommands/clear subcommands/remove subcommands/set subcommands/report
|
||||
TRIGGERS = triggers/post-certs-remove triggers/post-certs-update triggers/report
|
||||
TRIGGERS = triggers/ports-get triggers/post-certs-remove triggers/post-certs-update triggers/report
|
||||
BUILD = commands subcommands triggers
|
||||
PLUGIN_NAME = ports
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ func main() {
|
||||
|
||||
var err error
|
||||
switch trigger {
|
||||
case "ports-get":
|
||||
appName := flag.Arg(0)
|
||||
err = ports.TriggerPortsGet(appName)
|
||||
case "post-certs-remove":
|
||||
appName := flag.Arg(0)
|
||||
err = ports.TriggerPostCertsRemove(appName)
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
package ports
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/dokku/dokku/plugins/config"
|
||||
)
|
||||
|
||||
// TriggerPortsGet prints out the port mapping for a given app
|
||||
func TriggerPortsGet(appName string) error {
|
||||
for _, portMap := range getPortMaps(appName) {
|
||||
if portMap.AllowsPersistence() {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Println(portMap)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TriggerPostCertsRemove unsets port config vars after SSL cert is added
|
||||
func TriggerPostCertsRemove(appName string) error {
|
||||
keys := []string{"DOKKU_PROXY_SSL_PORT"}
|
||||
|
||||
Reference in New Issue
Block a user