From 0e263eca4109afa2a326e1647d451f6ecbf4aba2 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Sun, 8 Jan 2023 12:35:53 -0500 Subject: use a flag for config file --- main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index d7ab887..d46e53e 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "sync" "time" @@ -26,9 +27,11 @@ func main() { // Config var cfg config.Config - //TODO use a flag here - //TODO ensure that handler names only contain AZa-z and '-' - _, err := toml.DecodeFile("sample-config.toml", &cfg) + var cFlag = flag.String("c", "sample-config.toml", "path to config file") + + flag.Parse() + + _, err := toml.DecodeFile(*cFlag, &cfg) if err != nil { log.Fatal(err) } -- cgit v1.2.3