mirror of
https://github.com/dokku/dokku.git
synced 2026-05-18 05:05:46 +02:00
The property name set via `app-json:set` is `appjson-path`, but the matching read-back flags on `app-json:report` were named `--app-json-selected`, `--app-json-global-selected`, and `--app-json-computed-selected`. The mismatch meant `dokku app-json:report <app> --app-json-appjson-path` (the form already documented in deployment-tasks.md) was rejected as an invalid flag, and the `--format json` output advertised keys that did not correspond to any settable property. The flags and JSON keys are renamed to `--app-json-appjson-path`, `--app-json-global-appjson-path`, and `--app-json-computed-appjson-path` so that the property name round-trips through set and report.
55 lines
1.5 KiB
Go
55 lines
1.5 KiB
Go
package appjson
|
|
|
|
import (
|
|
"github.com/dokku/dokku/plugins/common"
|
|
)
|
|
|
|
// ReportSingleApp is an internal function that displays the builder report for one or more apps
|
|
func ReportSingleApp(appName string, format string, infoFlag string) error {
|
|
if appName != "--global" {
|
|
if err := common.VerifyAppName(appName); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
var flags map[string]common.ReportFunc
|
|
if appName == "--global" {
|
|
flags = map[string]common.ReportFunc{
|
|
"--app-json-global-appjson-path": reportGlobalAppjsonpath,
|
|
}
|
|
} else {
|
|
flags = map[string]common.ReportFunc{
|
|
"--app-json-computed-appjson-path": reportComputedAppjsonpath,
|
|
"--app-json-global-appjson-path": reportGlobalAppjsonpath,
|
|
"--app-json-appjson-path": reportAppjsonpath,
|
|
}
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
trimPrefix := false
|
|
uppercaseFirstCharacter := true
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp("app-json", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
|
}
|
|
|
|
func reportComputedAppjsonpath(appName string) string {
|
|
value := reportAppjsonpath(appName)
|
|
if value == "" {
|
|
value = reportGlobalAppjsonpath(appName)
|
|
}
|
|
|
|
return value
|
|
}
|
|
|
|
func reportGlobalAppjsonpath(appName string) string {
|
|
return common.PropertyGetDefault("app-json", "--global", "appjson-path", "app.json")
|
|
}
|
|
|
|
func reportAppjsonpath(appName string) string {
|
|
return common.PropertyGet("app-json", appName, "appjson-path")
|
|
}
|