From 4cc2dc7844d770605c2547357917d37dc185d11f Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 10 Nov 2025 01:58:02 -0500 Subject: [PATCH] feat: add cron maintenance info to cron:report output --- plugins/cron/report.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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") }