From 6ff74852ebb70aa7cc24da89390e2607bac58369 Mon Sep 17 00:00:00 2001 From: horus Date: Fri, 16 Feb 2018 18:07:54 +0100 Subject: Pass the config file via command line flag. (crawler) --- crawler/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crawler/main.go') diff --git a/crawler/main.go b/crawler/main.go index 11dfd4d..69f9638 100644 --- a/crawler/main.go +++ b/crawler/main.go @@ -2,14 +2,15 @@ package main import ( "encoding/json" + "flag" "fmt" - log "github.com/Sirupsen/logrus" "time" _ "database/sql" _ "github.com/go-sql-driver/mysql" //_ "github.com/mattn/go-sqlite3" + log "github.com/Sirupsen/logrus" "github.com/jmoiron/sqlx" ) @@ -53,8 +54,11 @@ func main() { var err error + configFile := flag.String("config", "", "path to config file") + flag.Parse() + app := App{Config: &Config{}} - app.Config.parseConfig("") + app.Config.parseConfig(*configFile) app.Now = time.Now().Unix() -- cgit v1.2.3