diff --git a/app/app.go b/app/app.go index 0276629624..00b9a7eb27 100644 --- a/app/app.go +++ b/app/app.go @@ -27,8 +27,10 @@ import ( type App struct { srv *Server - log *mlog.Logger - notificationsLog *mlog.Logger + // XXX: This is required because removing this needs BleveEngine + // to be registered in (h *MainHelper) setupStore, but that creates + // a cyclic dependency as bleve tests themselves import testlib. + searchEngine *searchengine.Broker t goi18n.TranslateFunc session model.Session @@ -38,17 +40,6 @@ type App struct { userAgent string acceptLanguage string - cluster einterfaces.ClusterInterface - compliance einterfaces.ComplianceInterface - dataRetention einterfaces.DataRetentionInterface - searchEngine *searchengine.Broker - messageExport einterfaces.MessageExportInterface - metrics einterfaces.MetricsInterface - - httpService httpservice.HTTPService - imageProxy *imageproxy.ImageProxy - timezones *timezones.Timezones - context context.Context } @@ -426,10 +417,10 @@ func (a *App) Srv() *Server { return a.srv } func (a *App) Log() *mlog.Logger { - return a.log + return a.srv.Log } func (a *App) NotificationsLog() *mlog.Logger { - return a.notificationsLog + return a.srv.NotificationsLog } func (a *App) T(translationID string, args ...interface{}) string { return a.t(translationID, args...) @@ -456,13 +447,13 @@ func (a *App) AccountMigration() einterfaces.AccountMigrationInterface { return a.srv.AccountMigration } func (a *App) Cluster() einterfaces.ClusterInterface { - return a.cluster + return a.srv.Cluster } func (a *App) Compliance() einterfaces.ComplianceInterface { - return a.compliance + return a.srv.Compliance } func (a *App) DataRetention() einterfaces.DataRetentionInterface { - return a.dataRetention + return a.srv.DataRetention } func (a *App) SearchEngine() *searchengine.Broker { return a.searchEngine @@ -471,10 +462,10 @@ func (a *App) Ldap() einterfaces.LdapInterface { return a.srv.Ldap } func (a *App) MessageExport() einterfaces.MessageExportInterface { - return a.messageExport + return a.srv.MessageExport } func (a *App) Metrics() einterfaces.MetricsInterface { - return a.metrics + return a.srv.Metrics } func (a *App) Notification() einterfaces.NotificationInterface { return a.srv.Notification @@ -483,13 +474,13 @@ func (a *App) Saml() einterfaces.SamlInterface { return a.srv.Saml } func (a *App) HTTPService() httpservice.HTTPService { - return a.httpService + return a.srv.HTTPService } func (a *App) ImageProxy() *imageproxy.ImageProxy { - return a.imageProxy + return a.srv.ImageProxy } func (a *App) Timezones() *timezones.Timezones { - return a.timezones + return a.srv.timezones } func (a *App) Context() context.Context { return a.context @@ -526,6 +517,8 @@ func (a *App) SetServer(srv *Server) { func (a *App) GetT() goi18n.TranslateFunc { return a.t } + +// TODO: change this to make a server method. func (a *App) SetLog(l *mlog.Logger) { - a.log = l + a.srv.Log = l } diff --git a/app/app_iface.go b/app/app_iface.go index 3b07d5e029..74837acfd3 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -296,6 +296,8 @@ type AppIface interface { // the member's group memberships and the configuration of those groups to the syncable. This method should only // be invoked on group-synced (aka group-constrained) syncables. SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError + // TODO: change this to make a server method. + SetLog(l *mlog.Logger) // TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given // groups. // @@ -893,7 +895,6 @@ type AppIface interface { SetContext(c context.Context) SetDefaultProfileImage(user *model.User) *model.AppError SetIpAddress(s string) - SetLog(l *mlog.Logger) SetPath(s string) SetPhase2PermissionsMigrationStatus(isComplete bool) error SetPluginKey(pluginId string, key string, value []byte) *model.AppError diff --git a/app/options.go b/app/options.go index 1bfb864477..33869823e1 100644 --- a/app/options.go +++ b/app/options.go @@ -97,18 +97,6 @@ type AppOptionCreator func() []AppOption func ServerConnector(s *Server) AppOption { return func(a *App) { a.srv = s - a.log = s.Log - a.notificationsLog = s.NotificationsLog - - a.cluster = s.Cluster - a.compliance = s.Compliance - a.dataRetention = s.DataRetention a.searchEngine = s.SearchEngine - a.messageExport = s.MessageExport - a.metrics = s.Metrics - - a.httpService = s.HTTPService - a.imageProxy = s.ImageProxy - a.timezones = s.timezones } } diff --git a/app/searchengine.go b/app/searchengine.go index 90170f2178..8a13fd98de 100644 --- a/app/searchengine.go +++ b/app/searchengine.go @@ -31,6 +31,10 @@ func (a *App) TestElasticsearch(cfg *model.Config) *model.AppError { return nil } +func (a *App) SetSearchEngine(se *searchengine.Broker) { + a.searchEngine = se +} + func (a *App) PurgeElasticsearchIndexes() *model.AppError { engine := a.SearchEngine().ElasticsearchEngine if engine == nil { @@ -56,7 +60,3 @@ func (a *App) PurgeBleveIndexes() *model.AppError { } return nil } - -func (a *App) SetSearchEngine(se *searchengine.Broker) { - a.searchEngine = se -}