aboutsummaryrefslogtreecommitdiff
path: root/internal/config/yaml.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/yaml.go')
-rw-r--r--internal/config/yaml.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/internal/config/yaml.go b/internal/config/yaml.go
index 335dede..aa58685 100644
--- a/internal/config/yaml.go
+++ b/internal/config/yaml.go
@@ -1,6 +1,14 @@
package config
-import "fmt"
+import (
+ "fmt"
+ "gopkg.in/yaml.v3"
+)
+
+type config struct {
+ GlobalConfig Map `yaml:",inline"`
+ Feeds []configGroupFeed
+}
type Group struct {
Group string
@@ -32,6 +40,16 @@ func (grpFeed *configGroupFeed) target() string {
return grpFeed.Group.Group
}
+func parse(buf []byte) (config, error) {
+ var parsedCfg config
+ if err := yaml.Unmarshal(buf, &parsedCfg); err != nil {
+ return parsedCfg, fmt.Errorf("while unmarshalling: %w", err)
+ }
+ fmt.Printf("--- parsedCfg:\n%+v\n\n", parsedCfg)
+
+ return parsedCfg, nil
+}
+
func appTarget(target, app string) string {
if target == "" {
return app