diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-08 17:35:53 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-08 17:35:53 +0000 |
commit | 0e263eca4109afa2a326e1647d451f6ecbf4aba2 (patch) | |
tree | 3234e59153d9579124d7edcf8da4a589554bb224 /main.go | |
parent | 7fc4591459dd36a34c0c8b55f5efd0e47de39c73 (diff) | |
download | communique-0e263eca4109afa2a326e1647d451f6ecbf4aba2.tar.gz |
use a flag for config file
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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) } |