From 7b439cc5680db7e6c2c7ef60f80e3ebe5c33c953 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 14 Dec 2018 17:45:31 +0100 Subject: [PATCH] Properly init tables for redis --- Featurecreep.md | 5 +++++ pkg/models/models.go | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Featurecreep.md b/Featurecreep.md index 53477f94..92f96cc6 100644 --- a/Featurecreep.md +++ b/Featurecreep.md @@ -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 diff --git a/pkg/models/models.go b/pkg/models/models.go index d632c3f5..433e119d 100644 --- a/pkg/models/models.go +++ b/pkg/models/models.go @@ -30,7 +30,8 @@ import ( var ( x *xorm.Engine - tables []interface{} + 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.")