1 // Config: parse triggers.yaml
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 // Copyright (C) 2021-2024 Simon Ruderich
15 "ruderich.org/simon/safcm"
18 func LoadTriggers(group string, files map[string]*safcm.File) error {
19 path := filepath.Join(group, "triggers.yaml")
21 var triggers map[string][]string
22 x, err := os.ReadFile(path)
24 if os.IsNotExist(err) {
29 err = yaml.UnmarshalStrict(x, &triggers)
31 return fmt.Errorf("%s: failed to load: %v", path, err)
34 for p, x := range triggers {
37 return fmt.Errorf("%s: %q does not exist in files/",