mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:00:54 +00:00
simple the session init
This commit is contained in:
parent
76522d43af
commit
15242d89ce
2
admin.go
2
admin.go
@ -113,8 +113,6 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
|
|||||||
m["SessionName"] = SessionName
|
m["SessionName"] = SessionName
|
||||||
m["SessionGCMaxLifetime"] = SessionGCMaxLifetime
|
m["SessionGCMaxLifetime"] = SessionGCMaxLifetime
|
||||||
m["SessionSavePath"] = SessionSavePath
|
m["SessionSavePath"] = SessionSavePath
|
||||||
m["SessionHashFunc"] = SessionHashFunc
|
|
||||||
m["SessionHashKey"] = SessionHashKey
|
|
||||||
m["SessionCookieLifeTime"] = SessionCookieLifeTime
|
m["SessionCookieLifeTime"] = SessionCookieLifeTime
|
||||||
m["UseFcgi"] = UseFcgi
|
m["UseFcgi"] = UseFcgi
|
||||||
m["MaxMemory"] = MaxMemory
|
m["MaxMemory"] = MaxMemory
|
||||||
|
2
beego.go
2
beego.go
@ -383,8 +383,6 @@ func initBeforeHttpRun() {
|
|||||||
`"gclifetime":` + strconv.FormatInt(SessionGCMaxLifetime, 10) + `,` +
|
`"gclifetime":` + strconv.FormatInt(SessionGCMaxLifetime, 10) + `,` +
|
||||||
`"providerConfig":"` + filepath.ToSlash(SessionSavePath) + `",` +
|
`"providerConfig":"` + filepath.ToSlash(SessionSavePath) + `",` +
|
||||||
`"secure":` + strconv.FormatBool(EnableHttpTLS) + `,` +
|
`"secure":` + strconv.FormatBool(EnableHttpTLS) + `,` +
|
||||||
`"sessionIDHashFunc":"` + SessionHashFunc + `",` +
|
|
||||||
`"sessionIDHashKey":"` + SessionHashKey + `",` +
|
|
||||||
`"enableSetCookie":` + strconv.FormatBool(SessionAutoSetCookie) + `,` +
|
`"enableSetCookie":` + strconv.FormatBool(SessionAutoSetCookie) + `,` +
|
||||||
`"domain":"` + SessionDomain + `",` +
|
`"domain":"` + SessionDomain + `",` +
|
||||||
`"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `}`
|
`"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `}`
|
||||||
|
12
config.go
12
config.go
@ -56,8 +56,6 @@ var (
|
|||||||
SessionName string // the cookie name when saving session id into cookie.
|
SessionName string // the cookie name when saving session id into cookie.
|
||||||
SessionGCMaxLifetime int64 // session gc time for auto cleaning expired session.
|
SessionGCMaxLifetime int64 // session gc time for auto cleaning expired session.
|
||||||
SessionSavePath string // if use mysql/redis/file provider, define save path to connection info.
|
SessionSavePath string // if use mysql/redis/file provider, define save path to connection info.
|
||||||
SessionHashFunc string // session hash generation func.
|
|
||||||
SessionHashKey string // session hash salt string.
|
|
||||||
SessionCookieLifeTime int // the life time of session id in cookie.
|
SessionCookieLifeTime int // the life time of session id in cookie.
|
||||||
SessionAutoSetCookie bool // auto setcookie
|
SessionAutoSetCookie bool // auto setcookie
|
||||||
SessionDomain string // the cookie domain default is empty
|
SessionDomain string // the cookie domain default is empty
|
||||||
@ -237,8 +235,6 @@ func init() {
|
|||||||
SessionName = "beegosessionID"
|
SessionName = "beegosessionID"
|
||||||
SessionGCMaxLifetime = 3600
|
SessionGCMaxLifetime = 3600
|
||||||
SessionSavePath = ""
|
SessionSavePath = ""
|
||||||
SessionHashFunc = "sha1"
|
|
||||||
SessionHashKey = "beegoserversessionkey"
|
|
||||||
SessionCookieLifeTime = 0 //set cookie default is the brower life
|
SessionCookieLifeTime = 0 //set cookie default is the brower life
|
||||||
SessionAutoSetCookie = true
|
SessionAutoSetCookie = true
|
||||||
|
|
||||||
@ -354,14 +350,6 @@ func ParseConfig() (err error) {
|
|||||||
SessionSavePath = sesssavepath
|
SessionSavePath = sesssavepath
|
||||||
}
|
}
|
||||||
|
|
||||||
if sesshashfunc := AppConfig.String("SessionHashFunc"); sesshashfunc != "" {
|
|
||||||
SessionHashFunc = sesshashfunc
|
|
||||||
}
|
|
||||||
|
|
||||||
if sesshashkey := AppConfig.String("SessionHashKey"); sesshashkey != "" {
|
|
||||||
SessionHashKey = sesshashkey
|
|
||||||
}
|
|
||||||
|
|
||||||
if sessMaxLifeTime, err := AppConfig.Int64("SessionGCMaxLifetime"); err == nil && sessMaxLifeTime != 0 {
|
if sessMaxLifeTime, err := AppConfig.Int64("SessionGCMaxLifetime"); err == nil && sessMaxLifeTime != 0 {
|
||||||
SessionGCMaxLifetime = sessMaxLifeTime
|
SessionGCMaxLifetime = sessMaxLifeTime
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user