default
This commit is contained in:
27
api/session.go
Normal file
27
api/session.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"github.com/gorilla/securecookie"
|
||||
"github.com/gorilla/sessions"
|
||||
. "main.go/type"
|
||||
)
|
||||
|
||||
|
||||
// sessions 存储于文件系统
|
||||
var Store *sessions.FilesystemStore
|
||||
|
||||
func init() {
|
||||
Store = sessions.NewFilesystemStore("./sessions", securecookie.GenerateRandomKey(32))
|
||||
|
||||
Store.Options = &sessions.Options{
|
||||
Domain: "",
|
||||
Path: "/",
|
||||
MaxAge: 24 * 60 * 60, // 1 day
|
||||
// SameSite: http.SameSiteNoneMode,
|
||||
Secure: false,
|
||||
HttpOnly: false,
|
||||
}
|
||||
|
||||
gob.Register(User{})
|
||||
}
|
Reference in New Issue
Block a user