Files
dokku/plugins/proxy/src/triggers/triggers.go
Jose Diaz-Gonzalez 64f0f2674d 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.
2023-08-05 10:58:57 -04:00

38 lines
709 B
Go

package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/proxy"
)
// main entrypoint to all triggers
func main() {
parts := strings.Split(os.Args[0], "/")
trigger := parts[len(parts)-1]
flag.Parse()
var err error
switch trigger {
case "proxy-is-enabled":
appName := flag.Arg(0)
err = proxy.TriggerProxyIsEnabled(appName)
case "proxy-type":
appName := flag.Arg(0)
err = proxy.TriggerProxyType(appName)
case "report":
appName := flag.Arg(0)
err = proxy.ReportSingleApp(appName, "", "")
default:
err = fmt.Errorf("Invalid plugin trigger call: %s", trigger)
}
if err != nil {
common.LogFailWithError(err)
}
}