Properly init tables for redis

This commit is contained in:
kolaente 2018-12-14 17:45:31 +01:00
parent 553055f073
commit 7b439cc568
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 21 additions and 1 deletions

View file

@ -235,6 +235,11 @@ Teams sind global, d.h. Ein Team kann mehrere Namespaces verwalten.
* [x] Password Reset -> Link via email oder so
* [ ] Settings
### Bugfixes
* [ ] Panic wenn mailer nicht erreichbar -> Als workaround mailer deaktivierbar machen, bzw keine mails verschicken
* [ ] "unexpected EOF"
### Docs
* [ ] Bauanleitung in die Readme/docs

View file

@ -31,6 +31,7 @@ var (
x *xorm.Engine
tables []interface{}
tablesWithPointer []interface{}
)
func getEngine() (*xorm.Engine, error) {
@ -68,6 +69,19 @@ func init() {
new(ListUser),
new(NamespaceUser),
)
tablesWithPointer = append(tables,
&User{},
&List{},
&ListTask{},
&Team{},
&TeamMember{},
&TeamList{},
&TeamNamespace{},
&Namespace{},
&ListUser{},
&NamespaceUser{},
)
}
// SetEngine sets the xorm.Engine
@ -88,6 +102,7 @@ func SetEngine() (err error) {
cacher := xrc.NewRedisCacher(viper.GetString("redis.host"), viper.GetString("redis.password"), xrc.DEFAULT_EXPIRATION, x.Logger())
x.SetDefaultCacher(cacher)
gob.Register(tables)
gob.Register(tablesWithPointer) // Need to register tables with pointer as well...
break
default:
fmt.Println("Did not find a valid cache type. Caching disabled. Please refer to the docs for poosible cache types.")