mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
The DOKKU_APP_TYPE has long since ceased to be the correct way to specify the builder for the application. It's only usage has been during the detection phase, specifically to ensure that the herokuish plugin injects the correct docker arguments during the build. As such, it is safe to migrate away to a property in a patch release. Users that seek to set a specific builder should use 'dokku builder:set $APP selected' instead. Refs #7863
70 lines
1.9 KiB
Go
70 lines
1.9 KiB
Go
package builder
|
|
|
|
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 err := common.VerifyAppName(appName); err != nil {
|
|
return err
|
|
}
|
|
|
|
flags := map[string]common.ReportFunc{
|
|
"--builder-computed-selected": reportComputedSelected,
|
|
"--builder-global-selected": reportGlobalSelected,
|
|
"--builder-selected": reportSelected,
|
|
"--builder-detected": reportDetected,
|
|
"--builder-computed-build-dir": reportComputedBuildDir,
|
|
"--builder-global-build-dir": reportGlobalBuildDir,
|
|
"--builder-build-dir": reportBuildDir,
|
|
}
|
|
|
|
flagKeys := []string{}
|
|
for flagKey := range flags {
|
|
flagKeys = append(flagKeys, flagKey)
|
|
}
|
|
|
|
trimPrefix := false
|
|
uppercaseFirstCharacter := true
|
|
infoFlags := common.CollectReport(appName, infoFlag, flags)
|
|
return common.ReportSingleApp("builder", appName, infoFlag, infoFlags, flagKeys, format, trimPrefix, uppercaseFirstCharacter)
|
|
}
|
|
|
|
func reportComputedSelected(appName string) string {
|
|
value := reportSelected(appName)
|
|
if value == "" {
|
|
value = reportGlobalSelected(appName)
|
|
}
|
|
|
|
return value
|
|
}
|
|
|
|
func reportGlobalSelected(appName string) string {
|
|
return common.PropertyGet("builder", "--global", "selected")
|
|
}
|
|
|
|
func reportDetected(appName string) string {
|
|
return common.PropertyGet("builder", appName, "detected")
|
|
}
|
|
|
|
func reportSelected(appName string) string {
|
|
return common.PropertyGet("builder", appName, "selected")
|
|
}
|
|
|
|
func reportComputedBuildDir(appName string) string {
|
|
value := reportBuildDir(appName)
|
|
if value == "" {
|
|
value = reportGlobalBuildDir(appName)
|
|
}
|
|
|
|
return value
|
|
}
|
|
func reportGlobalBuildDir(appName string) string {
|
|
return common.PropertyGet("builder", "--global", "build-dir")
|
|
}
|
|
|
|
func reportBuildDir(appName string) string {
|
|
return common.PropertyGet("builder", appName, "build-dir")
|
|
}
|