Damnit again

Former-commit-id: b394f26caf0df7d113ac4cc7dacc9c544af6897f
This commit is contained in:
bel
2019-06-21 18:12:31 -06:00
commit 90a31495c9
32 changed files with 3464 additions and 0 deletions

42
main.go Normal file
View File

@@ -0,0 +1,42 @@
package main
import (
"local/rssmon3/copart/config"
"local/rssmon3/copart/server"
"log"
"os"
"os/signal"
"syscall"
"time"
)
func main() {
log.SetPrefix("..")
time.Local = time.FixedZone("UTC-6", (-6*int(time.Hour))/int(time.Second))
sigc := make(chan os.Signal)
if err := config.New(); err != nil {
panic(err)
}
log.Println(config.Values())
s := server.New()
if err := s.Routes(); err != nil {
panic(err)
}
go func(c chan os.Signal) {
if err := s.Run(); err != nil {
log.Println(err)
}
c <- syscall.SIGINT
}(sigc)
signal.Notify(sigc,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT,
)
<-sigc
config.Values().DB.Close()
}