Files
dokku/plugins/common/subprocess.go
Jose Diaz-Gonzalez 4bae815f82 chore: remove codeskyblue/go-sh
It has been replaced with alexellis/go-execute.
2024-03-14 03:14:22 -04:00

24 lines
657 B
Go

package common
import (
"path/filepath"
"strings"
)
// PlugnTriggerExists returns whether a plugin trigger exists (ignoring the existence of any within the 20_events plugin)
func PlugnTriggerExists(triggerName string) bool {
pluginPath := MustGetEnv("PLUGIN_PATH")
pluginPathPrefix := filepath.Join(pluginPath, "enabled")
glob := filepath.Join(pluginPathPrefix, "*", triggerName)
exists := false
files, _ := filepath.Glob(glob)
for _, file := range files {
plugin := strings.Trim(strings.TrimPrefix(strings.TrimSuffix(file, "/"+triggerName), pluginPathPrefix), "/")
if plugin != "20_events" {
exists = true
break
}
}
return exists
}