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/util"
|
||||
"git.arav.top/Arav/dwelling-home/web"
|
||||
gbsqlite "git.arav.top/Arav/justguestbook/database/sqlite"
|
||||
)
|
||||
|
||||
type Handlers struct {
|
||||
guestbookDB *gbsqlite.SQLiteDatabase
|
||||
captchaExpire time.Duration
|
||||
databasesPath string
|
||||
guestbookOwner string
|
||||
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{
|
||||
guestbookDB: gbdb,
|
||||
captchaExpire: captchaExpire,
|
||||
databasesPath: dbPath,
|
||||
guestbookOwner: gbOwner,
|
||||
guestbookPageSize: gbPageSize}
|
||||
}
|
||||
|
||||
func (h *Handlers) CloseDB() {
|
||||
h.guestbookDB.Close()
|
||||
}
|
||||
|
||||
func (h *Handlers) AssetsFS() http.FileSystem {
|
||||
return web.Assets()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user