From eac57d05ba2fd3d3bd95da73bec5fc6de48720bf Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 16 Nov 2014 22:25:27 +0800 Subject: [PATCH] Fix #153 --- conf/wide.go | 6 +++--- main.go | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conf/wide.go b/conf/wide.go index 813a55c..09a57e4 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -265,12 +265,12 @@ func Save() bool { } // Load loads the configurations from wide.json. -func Load() { - bytes, _ := ioutil.ReadFile("conf/wide.json") +func Load(confPath string) { + bytes, _ := ioutil.ReadFile(confPath) err := json.Unmarshal(bytes, &Wide) if err != nil { - glog.Error(err) + glog.Error("Parses wide.json error: ", err) os.Exit(-1) } diff --git a/main.go b/main.go index c43c37a..0b4fa7d 100644 --- a/main.go +++ b/main.go @@ -40,6 +40,8 @@ import ( // The only one init function in Wide. func init() { // TODO: args + confPath := flag.String("conf", "conf/wide.json", "path of wide.json") + flag.Set("logtostderr", "true") flag.Set("v", "3") flag.Parse() @@ -48,7 +50,8 @@ func init() { event.Load() - conf.Load() + conf.Load(*confPath) + conf.FixedTimeCheckEnv() conf.FixedTimeSave()