refactor: move app listing back to common

Without this, we'd need to duplicate some logic or make it more complex via a plugin trigger.
This commit is contained in:
Jose Diaz-Gonzalez
2022-02-26 02:55:34 -05:00
parent 90eb5462f7
commit ac58b502c5
27 changed files with 83 additions and 128 deletions

View File

@@ -244,12 +244,12 @@ func GetRunningImageTag(appName string, imageTag string) (string, error) {
}
// DokkuApps returns a list of all local apps
func DokkuApps() (apps []string, err error) {
func DokkuApps() ([]string, error) {
apps := []string{}
dokkuRoot := MustGetEnv("DOKKU_ROOT")
files, err := ioutil.ReadDir(dokkuRoot)
if err != nil {
err = fmt.Errorf("You haven't deployed any applications yet")
return
return apps, fmt.Errorf("You haven't deployed any applications yet")
}
for _, f := range files {
@@ -264,11 +264,10 @@ func DokkuApps() (apps []string, err error) {
}
if len(apps) == 0 {
err = fmt.Errorf("You haven't deployed any applications yet")
return
return apps, fmt.Errorf("You haven't deployed any applications yet")
}
return
return filterApps(apps)
}
// GetAppImageName returns image identifier for a given app, tag tuple. validate if tag is presented