|
|
|
@@ -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) { |