diff --git a/plugins/cron/report.go b/plugins/cron/report.go index acf9760cb..6577b0a9a 100644 --- a/plugins/cron/report.go +++ b/plugins/cron/report.go @@ -1,7 +1,9 @@ package cron import ( + "fmt" "strconv" + "strings" "github.com/dokku/dokku/plugins/common" ) @@ -21,6 +23,11 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { "--cron-maintenance": reportMaintenance, } + extraFlags := addCronMaintenanceFlags(appName, infoFlag) + for flag, fn := range extraFlags { + flags[flag] = fn + } + flagKeys := []string{} for flagKey := range flags { flagKeys = append(flagKeys, flagKey) @@ -32,6 +39,24 @@ func ReportSingleApp(appName string, format string, infoFlag string) error { return common.ReportSingleApp("cron", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter) } +func addCronMaintenanceFlags(appName string, infoFlag string) map[string]common.ReportFunc { + flags := map[string]common.ReportFunc{} + + properties, err := common.PropertyGetAllByPrefix("cron", appName, MaintenancePropertyPrefix) + if err != nil { + return flags + } + + for property, value := range properties { + key := strings.Replace(property, MaintenancePropertyPrefix, "", 1) + flags[fmt.Sprintf("--cron-maintenance-%s", key)] = func(appName string) string { + return value + } + } + + return flags +} + func reportMailfrom(_ string) string { return common.PropertyGet("cron", "--global", "mailfrom") }