Merge pull request #8498 from dokku/migrate-env-vars-to-properties
Migrate environment variables to plugin properties
This commit is contained in:
@@ -3,14 +3,16 @@ package builder
|
||||
var (
|
||||
// DefaultProperties is a map of all valid builder properties with corresponding default property values
|
||||
DefaultProperties = map[string]string{
|
||||
"selected": "",
|
||||
"detected": "",
|
||||
"build-dir": "",
|
||||
"build-dir": "",
|
||||
"detected": "",
|
||||
"selected": "",
|
||||
"skip-cleanup": "",
|
||||
}
|
||||
|
||||
// GlobalProperties is a map of all valid global builder properties
|
||||
GlobalProperties = map[string]bool{
|
||||
"selected": true,
|
||||
"build-dir": true,
|
||||
"build-dir": true,
|
||||
"selected": true,
|
||||
"skip-cleanup": true,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -108,30 +108,21 @@ func TriggerInstall() error {
|
||||
return fmt.Errorf("Unable to install the builder plugin: %s", err.Error())
|
||||
}
|
||||
|
||||
apps, err := common.UnfilteredDokkuApps()
|
||||
if err != nil && !errors.Is(err, common.NoAppsExist) {
|
||||
return nil
|
||||
if err := common.MigrateConfigToProperties("builder", []common.MigrateConfigEntry{
|
||||
{
|
||||
ConfigVar: "DOKKU_APP_TYPE",
|
||||
Property: "detected",
|
||||
},
|
||||
{
|
||||
ConfigVar: "DOKKU_SKIP_CLEANUP",
|
||||
GlobalConfigVar: "DOKKU_SKIP_CLEANUP",
|
||||
Property: "skip-cleanup",
|
||||
},
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, appName := range apps {
|
||||
if common.PropertyExists("builder", appName, "detected") {
|
||||
continue
|
||||
}
|
||||
|
||||
results, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_APP_TYPE"},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if results.StdoutContents() != "" {
|
||||
common.PropertyWrite("builder", appName, "detected", results.StdoutContents())
|
||||
}
|
||||
}
|
||||
|
||||
_, err = common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "install-builder-prune",
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user