move get funcs to db

This commit is contained in:
sentriz
2019-07-05 17:10:11 +01:00
parent 1ab24db5d7
commit b6b3043765
13 changed files with 79 additions and 73 deletions

View File

@@ -80,12 +80,12 @@ func staticHandler(assets *Assets, path string) http.HandlerFunc {
}
func (s *Server) SetupAdmin() error {
sessionKey := []byte(s.GetSetting("session_key"))
sessionKey := []byte(s.DB.GetSetting("session_key"))
if len(sessionKey) == 0 {
sessionKey = securecookie.GenerateRandomKey(32)
s.SetSetting("session_key", string(sessionKey))
s.DB.SetSetting("session_key", string(sessionKey))
}
s.SessDB = gormstore.New(s.DB, sessionKey)
s.SessDB = gormstore.New(s.DB.DB, sessionKey)
go s.SessDB.PeriodicCleanup(time.Hour, nil)
//
tmplBase := template.