aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-12-21 19:01:42 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-12-21 19:01:42 +0100
commit453e9805ef6583e2177fb55fa1e45cf5816a7e67 (patch)
tree84374b8f86fe53cae3f24d39343b5930f25129ea /main.go
parent1c86bdda2a3067ade9aa765d8d87fe27151dd895 (diff)
feat(backend): connect to sqlite db
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 10 insertions, 0 deletions
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")