🔧 Provide config path using flag
Tim Izzo tim@5ika.ch
Sun, 20 Jul 2025 15:11:59 +0200
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
config.go
→
config.go
@@ -3,6 +3,7 @@
import ( "crypto/tls" "crypto/x509" + "flag" "os" "github.com/charmbracelet/log"@@ -22,7 +23,10 @@ TodoPath string `yaml:"todoPath"`
} func getConfig() Config { - configFile, err := os.ReadFile("./config.yaml") + configPath := flag.String("config", "config.yaml", "Path to config file") + flag.Parse() + + configFile, err := os.ReadFile(*configPath) if err != nil { log.Fatalf("Can't read config file: %s", err) }