Configuration file patch is dynamic

This commit is contained in:
Mael G. 2020-12-13 21:04:29 -04:00
parent c858b1b5e1
commit 44147b07f2

View file

@ -2,6 +2,7 @@ package main
import ( import (
"database/sql" "database/sql"
"flag"
"strconv" "strconv"
"github.com/miekg/dns" "github.com/miekg/dns"
@ -17,9 +18,13 @@ var DB *sql.DB
//Main loop //Main loop
func main() { func main() {
//Get config patch
configPatch := flag.String("config", "extra/config.ini.example", "the patch to the config file")
flag.Parse()
//Load Configuration //Load Configuration
conf = new(utils.Conf) conf = new(utils.Conf)
err := ini.MapTo(conf, "./config.ini") err := ini.MapTo(conf, *configPatch)
utils.CheckErr(err) utils.CheckErr(err)
utils.InitLogger(conf) utils.InitLogger(conf)