1
0

Moved mindflowDB init up.

This commit is contained in:
Alexander Andreev 2023-05-19 21:54:28 +04:00
parent bf0787d8b6
commit fb5188d565
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -59,7 +59,13 @@ func main() {
} }
defer guestbookDB.Close() defer guestbookDB.Close()
hand := http.NewHandlers(*captchaExpiry, *guestbookOwner, *guestbookPageSize, guestbookDB) mindflowDB, err := mfsqlite.New(path.Join(*databasesPath, "mindflow.sqlite"))
if err != nil {
log.Fatalln(err)
}
defer mindflowDB.Close()
hand := http.NewHandlers(*captchaExpiry, *guestbookOwner, *guestbookPageSize, guestbookDB, mindflowDB)
defer hand.CloseDB() defer hand.CloseDB()
srv := http.NewHttpServer() srv := http.NewHttpServer()
@ -95,12 +101,6 @@ func main() {
srv.PATCH("/api/guestbook/:id/reply", guestbookApi.EditReply) srv.PATCH("/api/guestbook/:id/reply", guestbookApi.EditReply)
srv.DELETE("/api/guestbook/:id/reply", guestbookApi.DeleteReply) srv.DELETE("/api/guestbook/:id/reply", guestbookApi.DeleteReply)
mindflowDB, err := mfsqlite.New(path.Join(*databasesPath, "mindflow.sqlite"))
if err != nil {
log.Fatalln(err)
}
defer mindflowDB.Close()
mindflowApi := http.NewMindflowApiHandlers(mindflowDB) mindflowApi := http.NewMindflowApiHandlers(mindflowDB)
srv.POST("/api/mindflow", mindflowApi.New) srv.POST("/api/mindflow", mindflowApi.New)