2021-02-13 00:46:35 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
2025-12-05 20:16:15 -05:00
|
|
|
"errors"
|
2021-02-13 00:46:35 -05:00
|
|
|
"fmt"
|
|
|
|
|
)
|
|
|
|
|
|
2022-02-26 02:55:34 -05:00
|
|
|
// TriggerAppList outputs each app name to stdout on a newline
|
2022-05-15 15:33:19 -04:00
|
|
|
func TriggerAppList(filtered bool) error {
|
|
|
|
|
var apps []string
|
|
|
|
|
if filtered {
|
|
|
|
|
apps, _ = DokkuApps()
|
|
|
|
|
} else {
|
|
|
|
|
apps, _ = UnfilteredDokkuApps()
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-26 02:55:34 -05:00
|
|
|
for _, app := range apps {
|
|
|
|
|
Log(app)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-13 00:46:35 -05:00
|
|
|
// TriggerCorePostDeploy associates the container with a specified network
|
|
|
|
|
func TriggerCorePostDeploy(appName string) error {
|
2023-01-21 16:43:43 -05:00
|
|
|
return EnvWrap(func() error {
|
2025-09-14 05:08:23 -04:00
|
|
|
return PropertyWrite("common", appName, "deployed", "true")
|
2023-01-21 16:43:43 -05:00
|
|
|
}, map[string]string{"DOKKU_QUIET_OUTPUT": "1"})
|
2021-02-13 00:46:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TriggerInstall runs the install step for the common plugin
|
|
|
|
|
func TriggerInstall() error {
|
|
|
|
|
if err := PropertySetup("common"); err != nil {
|
|
|
|
|
return fmt.Errorf("Unable to install the common plugin: %s", err.Error())
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-15 15:47:13 -04:00
|
|
|
apps, err := UnfilteredDokkuApps()
|
2025-12-05 20:16:15 -05:00
|
|
|
if err != nil && !errors.Is(err, NoAppsExist) {
|
2021-02-13 00:46:35 -05:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// migrate all is-deployed values from trigger to property
|
|
|
|
|
for _, appName := range apps {
|
|
|
|
|
IsDeployed(appName)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-03 14:34:14 -04:00
|
|
|
// TriggerPostAppCloneSetup copies common files
|
|
|
|
|
func TriggerPostAppCloneSetup(oldAppName string, newAppName string) error {
|
|
|
|
|
if err := PropertyClone("common", oldAppName, newAppName); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := PropertyDelete("common", oldAppName, "deployed"); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TriggerPostAppRenameSetup renames common files
|
|
|
|
|
func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error {
|
|
|
|
|
if err := PropertyClone("common", oldAppName, newAppName); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := PropertyDestroy("common", oldAppName); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-13 00:46:35 -05:00
|
|
|
// TriggerPostDelete destroys the common property for a given app container
|
|
|
|
|
func TriggerPostDelete(appName string) error {
|
|
|
|
|
return PropertyDestroy("common", appName)
|
|
|
|
|
}
|