feat: first pass at registry plugin

This commit is contained in:
Jose Diaz-Gonzalez
2021-03-04 20:44:49 -05:00
parent 518337812f
commit a755f69e92
12 changed files with 429 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/registry"
)
// 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 "install":
err = registry.TriggerInstall()
case "post-delete":
appName := flag.Arg(0)
err = registry.TriggerPostDelete(appName)
case "report":
appName := flag.Arg(0)
err = registry.ReportSingleApp(appName, "", "")
default:
err = fmt.Errorf("Invalid plugin trigger call: %s", trigger)
}
if err != nil {
common.LogFailWithError(err)
}
}