mirror of
https://github.com/astaxie/beego.git
synced 2024-12-26 12:10:49 +00:00
beego support new version session
This commit is contained in:
parent
481448fa90
commit
9cbd475701
19
beego.go
19
beego.go
@ -191,14 +191,19 @@ func Run() {
|
||||
}
|
||||
|
||||
if SessionOn {
|
||||
sessionConfig := AppConfig.String("sessionConfig")
|
||||
if sessionConfig == "" {
|
||||
sessionConfig = `{"cookieName":` + SessionName + `,` +
|
||||
`"gclifetime":` + SessionGCMaxLifetime + `,` +
|
||||
`"providerConfig":` + SessionSavePath + `,` +
|
||||
`"secure":` + HttpTLS + `,` +
|
||||
`"sessionIDHashFunc":` + SessionHashFunc + `,` +
|
||||
`"sessionIDHashKey":` + SessionHashKey + `,` +
|
||||
`"enableSetCookie":` + SessionAutoSetCookie + `,` +
|
||||
`"cookieLifeTime":` + SessionCookieLifeTime + `,}`
|
||||
}
|
||||
GlobalSessions, _ = session.NewManager(SessionProvider,
|
||||
SessionName,
|
||||
SessionGCMaxLifetime,
|
||||
SessionSavePath,
|
||||
HttpTLS,
|
||||
SessionHashFunc,
|
||||
SessionHashKey,
|
||||
SessionCookieLifeTime)
|
||||
sessionConfig)
|
||||
go GlobalSessions.GC()
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ var (
|
||||
SessionHashFunc string // session hash generation func.
|
||||
SessionHashKey string // session hash salt string.
|
||||
SessionCookieLifeTime int // the life time of session id in cookie.
|
||||
SessionAutoSetCookie bool // auto setcookie
|
||||
UseFcgi bool
|
||||
MaxMemory int64
|
||||
EnableGzip bool // flag of enable gzip
|
||||
@ -96,6 +97,7 @@ func init() {
|
||||
SessionHashFunc = "sha1"
|
||||
SessionHashKey = "beegoserversessionkey"
|
||||
SessionCookieLifeTime = 0 //set cookie default is the brower life
|
||||
SessionAutoSetCookie = true
|
||||
|
||||
UseFcgi = false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user