Files
dokku/plugins/logs/report.go
Jose Diaz-Gonzalez 1c0bd39d42 feat: ensure referenced images get updated by dependabot
Dokku uses a few external images for various bits of functionality, but these must be manually updated every so often due to being referenced in code.

By moving the references to Dockerfiles, we can take advantage of dependabot to issue automatic PRs when they are out of date.
2024-02-25 00:54:11 -05:00

61 lines
1.7 KiB
Go

package logs
import (
"github.com/dokku/dokku/plugins/common"
)
// ReportSingleApp is an internal function that displays the logs report for one or more apps
func ReportSingleApp(appName string, format string, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
flags := map[string]common.ReportFunc{
"--logs-computed-max-size": reportComputedMaxSize,
"--logs-global-max-size": reportGlobalMaxSize,
"--logs-global-vector-sink": reportGlobalVectorSink,
"--logs-max-size": reportMaxSize,
"--logs-vector-global-image": reportVectorGlobalImage,
"--logs-vector-sink": reportVectorSink,
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("logs", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
}
func reportComputedMaxSize(appName string) string {
value := reportMaxSize(appName)
if value == "" {
value = reportGlobalMaxSize(appName)
}
return value
}
func reportGlobalMaxSize(appName string) string {
return common.PropertyGetDefault("logs", "--global", "max-size", MaxSize)
}
func reportVectorGlobalImage(appName string) string {
return getComputedVectorImage()
}
func reportGlobalVectorSink(appName string) string {
return common.PropertyGet("logs", "--global", "vector-sink")
}
func reportMaxSize(appName string) string {
return common.PropertyGet("logs", appName, "max-size")
}
func reportVectorSink(appName string) string {
return common.PropertyGet("logs", appName, "vector-sink")
}