2017-06-15 09:30:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-08-30 20:23:35 +00:00
|
|
|
"fmt"
|
2019-09-01 20:59:51 +00:00
|
|
|
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/config"
|
|
|
|
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/models"
|
|
|
|
"git.kolaente.de/konrad/Konfi-Castle-Kasino/pkg/router"
|
2017-06-17 12:12:50 +00:00
|
|
|
"github.com/astaxie/session"
|
|
|
|
_ "github.com/astaxie/session/providers/memory"
|
2017-08-31 20:49:55 +00:00
|
|
|
"github.com/asticode/go-astilectron"
|
|
|
|
"github.com/asticode/go-astilog"
|
|
|
|
"github.com/pkg/errors"
|
2017-06-15 09:30:32 +00:00
|
|
|
)
|
|
|
|
|
2017-06-17 12:12:50 +00:00
|
|
|
//Initialize Session
|
|
|
|
var GlobalSessions *session.Manager
|
|
|
|
|
|
|
|
// initialize in init() function
|
|
|
|
func Init() {
|
|
|
|
GlobalSessions, _ = session.NewManager("memory", "kasinoadmin", 43200)
|
|
|
|
go GlobalSessions.GC()
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
//Session init
|
|
|
|
Init()
|
|
|
|
|
2017-06-17 16:49:01 +00:00
|
|
|
//Startup Banner
|
2019-09-01 17:02:25 +00:00
|
|
|
fmt.Println(`
|
|
|
|
################################################################
|
|
|
|
# _ __ __ _ _____ _ _ #
|
|
|
|
# | | / / / _(_) ____ / __ \ | | | | #
|
|
|
|
# | |/ / ___ _ __ | |_ _ / __ \| / \/ __ _ ___| |_| | ___ #
|
|
|
|
# | \ / _ \| '_ \| _| |/ / _` + "`" + ` | | / _` + "`" + ` / __| __| |/ _ \ #
|
|
|
|
# | |\ \ (_) | | | | | | | | (_| | \__/\ (_| \__ \ |_| | __/ #
|
|
|
|
# \_| \_/\___/|_| |_|_| |_|\ \__,_|\____/\__,_|___/\__|_|\___| #
|
|
|
|
# \____/ #
|
|
|
|
# #
|
|
|
|
# _ __ _ #
|
|
|
|
# | | / / (_) #
|
|
|
|
# | |/ / __ _ ___ _ _ __ ___ #
|
|
|
|
# | \ / _` + "`" + ` / __| | '_ \ / _ \ #
|
|
|
|
# | |\ \ (_| \__ \ | | | | (_) | #
|
|
|
|
# \_| \_/\__,_|___/_|_| |_|\___/ #
|
|
|
|
# #
|
|
|
|
# © 2017-2019 Konrad Langenberg (konradlangenberg.de) #
|
2019-09-01 20:59:51 +00:00
|
|
|
# Version: ` + models.Version + ` #
|
2019-09-01 17:02:25 +00:00
|
|
|
################################################################`)
|
2017-06-17 16:49:01 +00:00
|
|
|
|
2017-06-17 12:12:50 +00:00
|
|
|
//DB init - Create tables
|
2019-09-01 20:59:51 +00:00
|
|
|
models.DBinit()
|
2017-06-17 12:12:50 +00:00
|
|
|
|
2017-08-31 16:56:49 +00:00
|
|
|
//Config
|
2019-09-01 20:59:51 +00:00
|
|
|
config.InitConfig()
|
|
|
|
|
|
|
|
//Echo init
|
|
|
|
e := router.NewEcho()
|
|
|
|
router.RegisterRoutes(e)
|
|
|
|
// Start server
|
|
|
|
go func() {
|
2019-09-02 20:19:12 +00:00
|
|
|
fmt.Println(config.GetConfig())
|
2019-09-01 20:59:51 +00:00
|
|
|
if err := e.Start(config.GetInterface()); err != nil {
|
|
|
|
e.Logger.Info("shutting down...")
|
|
|
|
}
|
|
|
|
}()
|
2017-08-31 16:56:49 +00:00
|
|
|
|
2019-09-01 20:59:51 +00:00
|
|
|
// TODO: Make sure everything still works
|
|
|
|
// TODO: Distribute as single binary
|
|
|
|
// TODO: Switch to viper
|
|
|
|
// TODO: SSE
|
|
|
|
// TODO: Build a fancy thing with interfaces to avoid context switching code all over the place
|
|
|
|
// TODO: Build a middleware which checks the auth for admin routes
|
|
|
|
// TODO: Tests?
|
2017-08-31 20:49:55 +00:00
|
|
|
|
|
|
|
//Windows
|
2019-09-02 20:19:12 +00:00
|
|
|
//windows.OpenWindows()
|
2017-06-15 09:30:32 +00:00
|
|
|
}
|