pass dataservice by ref

This commit is contained in:
Umputun
2018-06-09 20:24:48 -05:00
parent 1af8b672a5
commit 4be58e2c9f
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ import (
// admin provides router for all requests available for admin users only
type admin struct {
dataService service.DataStore
dataService *service.DataStore
exporter migrator.Exporter
cache cache.LoadingCache
authenticator auth.Authenticator
+1 -1
View File
@@ -31,7 +31,7 @@ import (
// Rest is a rest access server
type Rest struct {
Version string
DataService service.DataStore
DataService *service.DataStore
Authenticator auth.Authenticator
Exporter migrator.Exporter
Cache cache.LoadingCache
+2 -2
View File
@@ -53,7 +53,7 @@ func TestRest_Shutdown(t *testing.T) {
func prep(t *testing.T) (srv *Rest, ts *httptest.Server) {
b, err := engine.NewBoltDB(bolt.Options{}, engine.BoltSite{FileName: testDb, SiteID: "radio-t"})
require.Nil(t, err)
dataStore := service.DataStore{Interface: b, EditDuration: 5 * time.Minute, MaxCommentSize: 4000, Secret: "123456"}
dataStore := &service.DataStore{Interface: b, EditDuration: 5 * time.Minute, MaxCommentSize: 4000, Secret: "123456"}
srv = &Rest{
DataService: dataStore,
Authenticator: auth.Authenticator{
@@ -63,7 +63,7 @@ func prep(t *testing.T) (srv *Rest, ts *httptest.Server) {
AdminEmail: "admin@remark-42.com",
JWTService: auth.NewJWT("12345", false, time.Minute),
},
Exporter: &migrator.Remark{DataStore: &dataStore},
Exporter: &migrator.Remark{DataStore: dataStore},
Cache: &mockCache{},
WebRoot: "/tmp",
RemarkURL: "https://demo.remark42.com",