50 lines
836 B
Go
50 lines
836 B
Go
//go:generate packr2 -v
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"git.paulbsd.com/paulbsd/qrz/src/config"
|
|
"git.paulbsd.com/paulbsd/qrz/src/database"
|
|
"git.paulbsd.com/paulbsd/qrz/src/qrz"
|
|
"git.paulbsd.com/paulbsd/qrz/src/qrzws"
|
|
"github.com/gobuffalo/packr/v2"
|
|
_ "github.com/lib/pq"
|
|
_ "github.com/spf13/cobra"
|
|
)
|
|
|
|
var version string
|
|
|
|
func main() {
|
|
var cfg config.Config
|
|
cfg.GetConfig()
|
|
|
|
cfg.Version = version
|
|
|
|
// Generate static files embedding
|
|
PackrGen()
|
|
|
|
err := database.Initialize(&cfg)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
defer cfg.Db.Close()
|
|
|
|
err = qrz.InitCronConfig(cfg)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
|
|
err = qrzws.RunServer(cfg)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
}
|
|
|
|
// PackrGen act as an assets bundle maker
|
|
func PackrGen() {
|
|
packr.New("static", "../../static")
|
|
packr.New("templates", "../../templates")
|
|
}
|