2013-12-26 03:45:52 -08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2013-12-29 14:53:20 -08:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
2014-01-01 04:37:00 -08:00
|
|
|
"flag"
|
2013-12-26 03:45:52 -08:00
|
|
|
)
|
|
|
|
|
2013-12-31 18:07:49 -08:00
|
|
|
const Debug = true
|
2013-12-28 06:18:23 -08:00
|
|
|
|
2014-01-01 04:37:00 -08:00
|
|
|
var StartDBQueryInterface bool
|
|
|
|
func Init() {
|
|
|
|
flag.BoolVar(&StartDBQueryInterface, "db", false, "start db query interface")
|
|
|
|
|
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
|
2013-12-29 14:53:20 -08:00
|
|
|
// Register interrupt handlers so we can stop the server
|
|
|
|
func RegisterInterupts(s *Server) {
|
|
|
|
// Buffered chan of one is enough
|
|
|
|
c := make(chan os.Signal, 1)
|
|
|
|
// Notify about interrupts for now
|
|
|
|
signal.Notify(c, os.Interrupt)
|
|
|
|
go func() {
|
|
|
|
for sig := range c {
|
|
|
|
fmt.Println("Shutting down (%v) ... \n", sig)
|
|
|
|
|
|
|
|
s.Stop()
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|
|
|
|
|
2013-12-26 03:45:52 -08:00
|
|
|
func main() {
|
|
|
|
InitFees()
|
|
|
|
|
2014-01-01 04:37:00 -08:00
|
|
|
Init()
|
2013-12-26 03:45:52 -08:00
|
|
|
|
2014-01-01 04:37:00 -08:00
|
|
|
if StartDBQueryInterface {
|
|
|
|
dbInterface := NewDBInterface()
|
|
|
|
dbInterface.Start()
|
|
|
|
} else {
|
|
|
|
Testing()
|
|
|
|
}
|
2013-12-26 03:45:52 -08:00
|
|
|
}
|