Standardize how environment variables are migrated to properties during install triggers and migrate all remaining DOKKU_* config vars to their appropriate plugin properties. Adds a reusable MigrateConfigToProperties() function in the common package with Transform callback and ListProperty support, plus a migrate-config-to-property subcommand for the prop binary so shell plugins can use the same code path. Migrated variables and their new property owners: - DOKKU_APP_PROXY_TYPE/DOKKU_PROXY_TYPE → proxy type - DOKKU_DISABLE_PROXY → proxy disabled - DOKKU_PROXY_PORT → ports proxy-port - DOKKU_PROXY_SSL_PORT → ports proxy-ssl-port - DOKKU_APP_RESTORE → ps restore - DOKKU_SKIP_DEPLOY → ps skip-deploy - DOKKU_START_CMD → ps start-cmd - DOKKU_DOCKERFILE_START_CMD → ps dockerfile-start-cmd - DOKKU_DISABLE_APP_AUTOCREATION → apps disable-autocreation - DOKKU_APP_SHELL → scheduler shell - DOKKU_SKIP_CLEANUP → builder skip-cleanup - DOKKU_CHECKS_DISABLED → checks disabled - DOKKU_CHECKS_SKIPPED → checks skipped - DOKKU_CHECKS_WAIT → checks wait - DOKKU_CHECKS_TIMEOUT → checks timeout - DOKKU_CHECKS_ATTEMPTS → checks attempts - DOKKU_DEFAULT_CHECKS_WAIT → checks default-wait - DOKKU_SKIP_ALL_CHECKS → checks disabled (legacy) - DOKKU_SKIP_DEFAULT_CHECKS → checks skipped (legacy) Also refactors existing bespoke migration loops in scheduler, ports, ps, builder, and nginx-vhosts plugins to use the standardized utility. Removes DOKKU_PARALLEL_ARGUMENTS from documentation (unused in core). Deprecates fn-migrate-config-to-property bash function. closes #1558
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/dokku/dokku/plugins/common"
|
|
"github.com/dokku/dokku/plugins/proxy"
|
|
)
|
|
|
|
// main entrypoint to all triggers
|
|
func main() {
|
|
parts := strings.Split(os.Args[0], "/")
|
|
trigger := parts[len(parts)-1]
|
|
flag.Parse()
|
|
|
|
var err error
|
|
switch trigger {
|
|
case "install":
|
|
err = proxy.TriggerInstall()
|
|
case "proxy-is-enabled":
|
|
appName := flag.Arg(0)
|
|
err = proxy.TriggerProxyIsEnabled(appName)
|
|
case "proxy-type":
|
|
appName := flag.Arg(0)
|
|
err = proxy.TriggerProxyType(appName)
|
|
case "post-app-clone-setup":
|
|
oldAppName := flag.Arg(0)
|
|
newAppName := flag.Arg(1)
|
|
err = proxy.TriggerPostAppCloneSetup(oldAppName, newAppName)
|
|
case "post-app-rename-setup":
|
|
oldAppName := flag.Arg(0)
|
|
newAppName := flag.Arg(1)
|
|
err = proxy.TriggerPostAppRenameSetup(oldAppName, newAppName)
|
|
case "post-delete":
|
|
appName := flag.Arg(0)
|
|
err = proxy.TriggerPostDelete(appName)
|
|
case "report":
|
|
appName := flag.Arg(0)
|
|
err = proxy.ReportSingleApp(appName, "", "")
|
|
default:
|
|
err = fmt.Errorf("Invalid plugin trigger call: %s", trigger)
|
|
}
|
|
|
|
if err != nil {
|
|
common.LogFailWithError(err)
|
|
}
|
|
}
|