Refactor server to go-sqlite and ginext [WIP]

This commit is contained in:
2024-07-15 17:26:55 +02:00
parent e6fbf85e6e
commit 55d0dea835
39 changed files with 880 additions and 996 deletions

View File

@@ -4,7 +4,6 @@ import (
"blackforestbytes.com/simplecloudnotifier/db/schema"
"context"
"fmt"
"github.com/mattn/go-sqlite3"
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
"time"
@@ -21,7 +20,7 @@ func main() {
fmt.Println()
for i := 2; i <= schema.PrimarySchemaVersion; i++ {
h0, err := sq.HashMattnSqliteSchema(ctx, schema.PrimarySchema[i].SQL)
h0, err := sq.HashGoSqliteSchema(ctx, schema.PrimarySchema[i].SQL)
if err != nil {
h0 = "ERR"
}
@@ -29,7 +28,7 @@ func main() {
}
for i := 1; i <= schema.RequestsSchemaVersion; i++ {
h0, err := sq.HashMattnSqliteSchema(ctx, schema.RequestsSchema[i].SQL)
h0, err := sq.HashGoSqliteSchema(ctx, schema.RequestsSchema[i].SQL)
if err != nil {
h0 = "ERR"
}
@@ -37,7 +36,7 @@ func main() {
}
for i := 1; i <= schema.LogsSchemaVersion; i++ {
h0, err := sq.HashMattnSqliteSchema(ctx, schema.LogsSchema[i].SQL)
h0, err := sq.HashGoSqliteSchema(ctx, schema.LogsSchema[i].SQL)
if err != nil {
h0 = "ERR"
}

View File

@@ -3,13 +3,14 @@ package main
import (
scn "blackforestbytes.com/simplecloudnotifier"
"blackforestbytes.com/simplecloudnotifier/api"
"blackforestbytes.com/simplecloudnotifier/api/ginext"
"blackforestbytes.com/simplecloudnotifier/google"
"blackforestbytes.com/simplecloudnotifier/jobs"
"blackforestbytes.com/simplecloudnotifier/logic"
"blackforestbytes.com/simplecloudnotifier/push"
"fmt"
"github.com/rs/zerolog/log"
"gogs.mikescher.com/BlackForestBytes/goext/ginext"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
)
func main() {
@@ -31,7 +32,12 @@ func main() {
return
}
ginengine := ginext.NewEngine(conf)
ginengine := ginext.NewEngine(ginext.Options{
AllowCors: &conf.Cors,
GinDebug: &conf.GinDebug,
BufferBody: langext.PTrue,
Timeout: &conf.RequestTimeout,
})
router := api.NewRouter(app)