The bash :report implementations for the caddy, haproxy, openresty, and traefik proxy plugins are replaced with a compiled golang binary that collects report keys in parallel and marshals json directly. The traefik dns-provider values keep their masking behaviour, remaining hidden in the default stdout report while surfacing for --format json or an explicit flag query. These four plugins previously had no unit tests, so a bats suite covering the report matrix is added for each.
32 lines
559 B
Go
32 lines
559 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/dokku/dokku/plugins/common"
|
|
haproxyvhosts "github.com/dokku/dokku/plugins/haproxy-vhosts"
|
|
)
|
|
|
|
// 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 "report":
|
|
appName := flag.Arg(0)
|
|
err = haproxyvhosts.ReportSingleApp(appName, "", "")
|
|
default:
|
|
err = fmt.Errorf("Invalid plugin trigger call: %s", trigger)
|
|
}
|
|
|
|
if err != nil {
|
|
common.LogFailWithError(err)
|
|
}
|
|
}
|