focalboard/server/app/app.go
Doug Lauder a47baf7f23
Multi version archive import (#2220)
* Fixed panic in PropDef.GetValue for `person` property types.
- the GetUserByID API can return a nil user and nil error

* return userid

* support old archive format

* move template init to app layer

* move app init

* init app

* revert

* ignore GetDefaultTemplate blocks call in store mock

* ignore GetDefaultTemplate blocks call in store mock2

* ignore InsertBlockss call in store mock3

* ignore RemoveDefaultTemplates call in store mock4

* ignore WriteFile call in files mock5

* ignore WriteFile call in files mock6

* ignore WriteFile call in files mock7

* ignore WriteFile call in files mock8

* fix unit tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-02-02 11:25:06 -07:00

58 lines
1.6 KiB
Go

package app
import (
"github.com/mattermost/focalboard/server/auth"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/metrics"
"github.com/mattermost/focalboard/server/services/notify"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/services/webhook"
"github.com/mattermost/focalboard/server/ws"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/filestore"
)
type Services struct {
Auth *auth.Auth
Store store.Store
FilesBackend filestore.FileBackend
Webhook *webhook.Client
Metrics *metrics.Metrics
Notifications *notify.Service
Logger *mlog.Logger
SkipTemplateInit bool
}
type App struct {
config *config.Configuration
store store.Store
auth *auth.Auth
wsAdapter ws.Adapter
filesBackend filestore.FileBackend
webhook *webhook.Client
metrics *metrics.Metrics
notifications *notify.Service
logger *mlog.Logger
}
func (a *App) SetConfig(config *config.Configuration) {
a.config = config
}
func New(config *config.Configuration, wsAdapter ws.Adapter, services Services) *App {
app := &App{
config: config,
store: services.Store,
auth: services.Auth,
wsAdapter: wsAdapter,
filesBackend: services.FilesBackend,
webhook: services.Webhook,
metrics: services.Metrics,
notifications: services.Notifications,
logger: services.Logger,
}
app.initialize(services.SkipTemplateInit)
return app
}