config.go (view raw)
1package main
2
3import (
4 "os"
5
6 "github.com/charmbracelet/log"
7 "gopkg.in/yaml.v3"
8)
9
10type Config struct {
11 TodoPath string `yaml:"todoPath"`
12}
13
14func getConfig(configPath string) Config {
15 configFile, err := os.ReadFile(configPath)
16 if err != nil {
17 log.Fatalf("Can't read config file: %s", err)
18 }
19
20 var cfg Config
21 yaml.Unmarshal(configFile, &cfg)
22 return cfg
23}