From 453e9805ef6583e2177fb55fa1e45cf5816a7e67 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sun, 21 Dec 2025 19:01:42 +0100 Subject: feat(backend): connect to sqlite db --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 480762d..6b5571e 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "os/signal" "strconv" "syscall" + "time" "git.anhgelus.world/anhgelus/small-web/backend" "github.com/joho/godotenv" @@ -58,6 +59,15 @@ func main() { os.Exit(1) } + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + db := backend.ConnectDatabase(cfg) + defer db.Close() + err := backend.RunMigration(ctx, db) + if err != nil { + panic(err) + } + for _, sec := range cfg.Sections { if ok = sec.Load(cfg); !ok { slog.Info("exiting") -- cgit v1.2.3