diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-21 19:01:42 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-12-21 19:01:42 +0100 |
| commit | 453e9805ef6583e2177fb55fa1e45cf5816a7e67 (patch) | |
| tree | 84374b8f86fe53cae3f24d39343b5930f25129ea /main.go | |
| parent | 1c86bdda2a3067ade9aa765d8d87fe27151dd895 (diff) | |
feat(backend): connect to sqlite db
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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") |
