Merge pull request #5648 from ywk253100/180817_session

Fix "gob: name not registered for interface" error
This commit is contained in:
Daniel Jiang 2018-08-17 16:00:48 +08:00 committed by GitHub
commit 257a728086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,7 @@
package main
import (
"encoding/gob"
"fmt"
"os"
"reflect"
@ -77,6 +78,7 @@ func main() {
//TODO
redisURL := os.Getenv("_REDIS_URL")
if len(redisURL) > 0 {
gob.Register(models.User{})
beego.BConfig.WebConfig.Session.SessionProvider = "redis"
beego.BConfig.WebConfig.Session.SessionProviderConfig = redisURL
}