package main

import (
	"log"

	_ "git.paulbsd.com/paulbsd/qrz/packrd"
	"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/lib/pq"
)

var version string

func main() {
	var config config.Config
	config.GetConfig()
	config.Version = version

	err := database.Initialize(&config)
	defer config.Db.Close()

	err = qrz.InitCronConfig(config)
	if err != nil {
		log.Fatalln(err)
	}

	err = qrzws.RunServer(config)
	if err != nil {
		log.Fatalln(err)
	}
}
