Files
dokku/plugins/config/triggers.go
Jose Diaz-Gonzalez 0405b36ab4 fix: implement config-export hook
This will allow dropping many of the "source config/functions" calls littered over the codebase. Plugin triggers are the way to perform cross-plugin communication :)
2021-02-11 06:41:11 -05:00

41 lines
766 B
Go

package config
import (
"fmt"
"strconv"
)
// TriggerConfigExport returns a global config value by key
func TriggerConfigExport(appName string, global string, merged string, format string) error {
g, err := strconv.ParseBool(global)
if err != nil {
return err
}
m, err := strconv.ParseBool(merged)
if err != nil {
return err
}
return export(appName, g, m, format)
}
// TriggerConfigGet returns an app config value by key
func TriggerConfigGet(appName string, key string) error {
value, ok := Get(appName, key)
if ok {
fmt.Print(value)
}
return nil
}
// TriggerConfigGetGlobal returns a global config value by key
func TriggerConfigGetGlobal(key string) error {
value, ok := Get("--global", key)
if ok {
fmt.Print(value)
}
return nil
}