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

@@ -164,8 +164,29 @@ func TriggerInstall() error {
if common.FileExists(dokkuScaleExtracted) {
os.Remove(dokkuScaleExtracted)
}
}
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-get",
Args: []string{appName, "DOKKU_DOCKER_STOP_TIMEOUT"},
})
stopTimeout := results.StdoutContents()
if stopTimeout == "" {
continue
}
common.LogVerboseQuiet(fmt.Sprintf("Setting %s ps property 'stop-timeout-seconds' to %v", appName, stopTimeout))
if err := common.PropertyWrite("ps", appName, "stop-timeout-seconds", stopTimeout); err != nil {
return err
}
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-unset",
Args: []string{appName, "DOKKU_DOCKER_STOP_TIMEOUT"},
})
if err != nil {
return err
}
}
return nil
}
@@ -320,3 +341,17 @@ func TriggerPsCurrentScale(appName string) error {
func TriggerPsSetScale(appName string, skipDeploy bool, clearExisting bool, processTuples []string) error {
return scaleSet(appName, skipDeploy, clearExisting, processTuples)
}
func TriggerPsGetProperty(appName string, property string) error {
computedValueMap := map[string]common.ReportFunc{
"stop-timeout-seconds": reportComputedStopTimeoutSeconds,
}
fn, ok := computedValueMap[property]
if !ok {
return fmt.Errorf("Invalid network property specified: %v", property)
}
fmt.Println(fn(appName))
return nil
}