1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Pass in a session store so they can be shared

This commit is contained in:
Daniel Heath 2018-04-28 12:09:08 +10:00
parent ff5c100cf8
commit ede4d1fba3

View File

@ -40,7 +40,7 @@ type Site struct {
DefaultPassword string
Debounce int
Diary bool
Secret string
SessionStore sessions.Store
SecretCode string
AllowInsecure bool
HotTemplateReloading bool
@ -88,7 +88,7 @@ func Serve(
defaultPassword,
debounce,
diary,
secret,
sessions.NewCookieStore([]byte(secret)),
secretCode,
allowInsecure,
hotTemplateReloading,
@ -130,8 +130,7 @@ func (s Site) Router() *gin.Engine {
router.HTMLRender = loadTemplates("index.tmpl")
}
store := sessions.NewCookieStore([]byte(s.Secret))
router.Use(sessions.Sessions("mysession", store))
router.Use(sessions.Sessions(s.PathToData, s.SessionStore))
if s.SecretCode != "" {
cfg := &secretRequired.Config{
Secret: s.SecretCode,