qrz/cmd/qrz/qrz.go

50 lines
836 B
Go
Raw Normal View History

//go:generate packr2 -v
2019-09-07 11:58:52 +02:00
package main
import (
"log"
2020-01-29 12:25:06 +01:00
"git.paulbsd.com/paulbsd/qrz/src/config"
"git.paulbsd.com/paulbsd/qrz/src/database"
2020-01-29 12:25:06 +01:00
"git.paulbsd.com/paulbsd/qrz/src/qrz"
"git.paulbsd.com/paulbsd/qrz/src/qrzws"
"github.com/gobuffalo/packr/v2"
2020-06-01 14:34:37 +02:00
_ "github.com/lib/pq"
2020-12-26 17:31:13 +01:00
_ "github.com/spf13/cobra"
2019-09-07 11:58:52 +02:00
)
var version string
2019-09-07 11:58:52 +02:00
func main() {
2020-06-01 14:34:37 +02:00
var cfg config.Config
cfg.GetConfig()
2020-06-01 14:34:37 +02:00
cfg.Version = version
2019-09-07 11:58:52 +02:00
// Generate static files embedding
PackrGen()
2020-06-01 14:34:37 +02:00
err := database.Initialize(&cfg)
2020-07-19 19:32:22 +02:00
if err != nil {
log.Fatalln(err)
}
2020-06-01 17:00:46 +02:00
defer cfg.Db.Close()
2019-09-07 11:58:52 +02:00
2020-06-01 14:34:37 +02:00
err = qrz.InitCronConfig(cfg)
2019-09-07 11:58:52 +02:00
if err != nil {
log.Println(err)
2019-09-07 11:58:52 +02:00
}
2020-06-01 14:34:37 +02:00
err = qrzws.RunServer(cfg)
2020-02-29 17:37:01 +01:00
if err != nil {
log.Println(err)
2020-02-29 17:37:01 +01:00
}
2019-09-07 11:58:52 +02:00
}
// PackrGen act as an assets bundle maker
func PackrGen() {
packr.New("static", "../../static")
packr.New("templates", "../../templates")
}