Added Guestbook DB to handlers.
This commit is contained in:
parent
cde9e4d34b
commit
5cd70b42bd
@ -9,23 +9,34 @@ import (
|
|||||||
"git.arav.top/Arav/dwelling-home/pkg/servicestat"
|
"git.arav.top/Arav/dwelling-home/pkg/servicestat"
|
||||||
"git.arav.top/Arav/dwelling-home/pkg/util"
|
"git.arav.top/Arav/dwelling-home/pkg/util"
|
||||||
"git.arav.top/Arav/dwelling-home/web"
|
"git.arav.top/Arav/dwelling-home/web"
|
||||||
|
gbsqlite "git.arav.top/Arav/justguestbook/database/sqlite"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Handlers struct {
|
type Handlers struct {
|
||||||
|
guestbookDB *gbsqlite.SQLiteDatabase
|
||||||
captchaExpire time.Duration
|
captchaExpire time.Duration
|
||||||
databasesPath string
|
databasesPath string
|
||||||
guestbookOwner string
|
guestbookOwner string
|
||||||
guestbookPageSize int64
|
guestbookPageSize int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHandlers(captchaExpire time.Duration, dbPath, gbOwner string, gbPageSize int) *Handlers {
|
func NewHandlers(captchaExpire time.Duration, dbPath, gbOwner string, gbPageSize int64) *Handlers {
|
||||||
|
gbdb, err := gbsqlite.New(dbPath + "/guestbook.sqlite")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
return &Handlers{
|
return &Handlers{
|
||||||
|
guestbookDB: gbdb,
|
||||||
captchaExpire: captchaExpire,
|
captchaExpire: captchaExpire,
|
||||||
databasesPath: dbPath,
|
|
||||||
guestbookOwner: gbOwner,
|
guestbookOwner: gbOwner,
|
||||||
guestbookPageSize: gbPageSize}
|
guestbookPageSize: gbPageSize}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *Handlers) CloseDB() {
|
||||||
|
h.guestbookDB.Close()
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Handlers) AssetsFS() http.FileSystem {
|
func (h *Handlers) AssetsFS() http.FileSystem {
|
||||||
return web.Assets()
|
return web.Assets()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user