SimpleCloudNotifier/server/cmd/scnserver/main.go

45 lines
888 B
Go
Raw Normal View History

2022-11-13 19:17:07 +01:00
package main
import (
scn "blackforestbytes.com/simplecloudnotifier"
"blackforestbytes.com/simplecloudnotifier/api"
"blackforestbytes.com/simplecloudnotifier/common"
"blackforestbytes.com/simplecloudnotifier/common/ginext"
"blackforestbytes.com/simplecloudnotifier/db"
2022-11-19 14:57:45 +01:00
"blackforestbytes.com/simplecloudnotifier/firebase"
2022-11-13 19:17:07 +01:00
"blackforestbytes.com/simplecloudnotifier/logic"
"fmt"
"github.com/rs/zerolog/log"
)
var conf = scn.Conf
func main() {
common.Init(conf)
log.Info().Msg(fmt.Sprintf("Starting with config-namespace <%s>", conf.Namespace))
2022-11-18 21:25:40 +01:00
sqlite, err := db.NewDatabase(conf)
2022-11-13 19:17:07 +01:00
if err != nil {
panic(err)
}
app := logic.NewApp(sqlite)
2022-11-18 21:25:40 +01:00
if err := app.Migrate(); err != nil {
panic(err)
}
2022-11-13 19:17:07 +01:00
ginengine := ginext.NewEngine(conf)
router := api.NewRouter(app)
2022-11-19 14:57:45 +01:00
fb := firebase.NewFirebaseApp()
app.Init(conf, ginengine, &fb)
2022-11-13 19:17:07 +01:00
router.Init(ginengine)
app.Run()
}