refactor: migrate DOKKU_DOCKER_STOP_TIMEOUT to ps setting

This commit is contained in:
Jose Diaz-Gonzalez
2025-03-09 04:26:47 -04:00
parent 758d9f8a83
commit 9beab4d50d
11 changed files with 131 additions and 21 deletions

View File

@@ -15,15 +15,18 @@ func ReportSingleApp(appName string, format string, infoFlag string) error {
}
flags := map[string]common.ReportFunc{
"--deployed": reportDeployed,
"--processes": reportProcesses,
"--ps-can-scale": reportCanScale,
"--ps-restart-policy": reportRestartPolicy,
"--ps-computed-procfile-path": reportComputedProcfilePath,
"--ps-global-procfile-path": reportGlobalProcfilePath,
"--ps-procfile-path": reportProcfilePath,
"--restore": reportRestore,
"--running": reportRunningState,
"--deployed": reportDeployed,
"--processes": reportProcesses,
"--ps-can-scale": reportCanScale,
"--ps-restart-policy": reportRestartPolicy,
"--ps-computed-procfile-path": reportComputedProcfilePath,
"--ps-global-procfile-path": reportGlobalProcfilePath,
"--ps-procfile-path": reportProcfilePath,
"--restore": reportRestore,
"--running": reportRunningState,
"--global-stop-timeout-seconds": reportGlobalStopTimeoutSeconds,
"--computed-stop-timeout-seconds": reportComputedStopTimeoutSeconds,
"--stop-timeout-seconds": reportStopTimeoutSeconds,
}
extraFlags := addStatusFlags(appName, infoFlag)
@@ -146,3 +149,20 @@ func reportRestore(appName string) string {
func reportRunningState(appName string) string {
return getRunningState(appName)
}
func reportComputedStopTimeoutSeconds(appName string) string {
value := reportStopTimeoutSeconds(appName)
if value == "" {
value = reportGlobalStopTimeoutSeconds(appName)
}
return value
}
func reportGlobalStopTimeoutSeconds(appName string) string {
return common.PropertyGetDefault("ps", "--global", "stop-timeout-seconds", "30")
}
func reportStopTimeoutSeconds(appName string) string {
return common.PropertyGetDefault("ps", appName, "stop-timeout-seconds", "30")
}