diff --git a/config.go b/config.go index b3e842c..2835c8e 100644 --- a/config.go +++ b/config.go @@ -9,7 +9,6 @@ import ( type AppConfig struct { Rpn struct { Url string `json:Url` - UrlTest string `json:UrlTest` MD5P2P string `json:MD5P2P` MD5FAT string `json:MD5FAT` MIDP2P string `json:MIDP2P` diff --git a/main.go b/main.go index f6d07c6..23606f9 100644 --- a/main.go +++ b/main.go @@ -9,18 +9,20 @@ import ( ) func main() { - readConfig() - //readConfigForTest() db.h = nil //make sure it's in proper state. - filename := "rpn.superforex." + time.Now().Format("20060102150406") + ".log" + //setup log file + filename := "logs/rpn.superforex." + time.Now().Format("2006-01-02-15-04-06") + ".log" f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { - log.Fatalf("error opening file: %v", err) + log.Fatalf("Error opening file: %v", err) } defer f.Close() log.SetOutput(f) - log.Println("Server started on: http://localhost:8080") + + //Read Config + readConfig() + //readConfigForTest() //setup http handler http.HandleFunc("/rpnNameAndCard", rpnNameAndCard) //ask name and card no @@ -28,10 +30,12 @@ func main() { http.HandleFunc("/alipay", leanworkInFAT) // leanwork in fs := wrapHandler(http.FileServer(http.Dir("./PG"))) //leanwork P2P embeded in http.HandleFunc("/", fs) - http.ListenAndServe(":8080", nil) - //start log file + //start listening + log.Println("Server started on: http://localhost:8080") + http.ListenAndServe(Config.Server.Host+":"+Config.Server.Port, nil) + //program never reach here. } func errPage(w http.ResponseWriter, code int, msg string) { diff --git a/rpnIn.go b/rpnIn.go index 7a11d90..07e5286 100644 --- a/rpnIn.go +++ b/rpnIn.go @@ -118,7 +118,7 @@ func (m *RpnIn) signature() (sig string) { s += "|pay_result=" + m.Pay_result s += "|key=" + m.md5key() sig = md5str(s) - log.Println("signature of rpnIn = " + sig + " using key " + m.md5key()) + //log.Println("signature of rpnIn = " + sig + " using key " + m.md5key()) return }