1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 14:00:54 +00:00
This commit is contained in:
astaxie 2014-01-09 21:37:50 +08:00
parent 299cb9130b
commit 844412c302

View File

@ -194,17 +194,20 @@ func Run() {
if SessionOn { if SessionOn {
sessionConfig := AppConfig.String("sessionConfig") sessionConfig := AppConfig.String("sessionConfig")
if sessionConfig == "" { if sessionConfig == "" {
sessionConfig = `{"cookieName":` + SessionName + `,` + sessionConfig = `{"cookieName":"` + SessionName + `",` +
`"gclifetime":` + strconv.FormatInt(SessionGCMaxLifetime, 10) + `,` + `"gclifetime":` + strconv.FormatInt(SessionGCMaxLifetime, 10) + `,` +
`"providerConfig":` + SessionSavePath + `,` + `"providerConfig":"` + SessionSavePath + `",` +
`"secure":` + strconv.FormatBool(HttpTLS) + `,` + `"secure":` + strconv.FormatBool(HttpTLS) + `,` +
`"sessionIDHashFunc":` + SessionHashFunc + `,` + `"sessionIDHashFunc":"` + SessionHashFunc + `",` +
`"sessionIDHashKey":` + SessionHashKey + `,` + `"sessionIDHashKey":"` + SessionHashKey + `",` +
`"enableSetCookie":` + strconv.FormatBool(SessionAutoSetCookie) + `,` + `"enableSetCookie":` + strconv.FormatBool(SessionAutoSetCookie) + `,` +
`"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `,}` `"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `}`
} }
GlobalSessions, _ = session.NewManager(SessionProvider, GlobalSessions, err := session.NewManager(SessionProvider,
sessionConfig) sessionConfig)
if err != nil {
panic(err)
}
go GlobalSessions.GC() go GlobalSessions.GC()
} }