2020-10-16 19:12:53 +02:00
|
|
|
package app
|
2020-10-16 16:21:42 +02:00
|
|
|
|
2020-10-16 16:36:08 +02:00
|
|
|
import (
|
2021-02-02 21:11:21 +01:00
|
|
|
"github.com/mattermost/focalboard/server/auth"
|
2021-01-26 23:13:46 +01:00
|
|
|
"github.com/mattermost/focalboard/server/services/config"
|
2021-06-04 16:38:49 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/metrics"
|
2021-09-13 21:36:36 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/notify"
|
2021-01-26 23:13:46 +01:00
|
|
|
"github.com/mattermost/focalboard/server/services/store"
|
|
|
|
"github.com/mattermost/focalboard/server/services/webhook"
|
2021-08-27 10:59:14 +02:00
|
|
|
"github.com/mattermost/focalboard/server/ws"
|
2021-05-29 08:23:10 +02:00
|
|
|
|
2021-08-25 22:08:01 +02:00
|
|
|
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
|
|
|
|
2021-08-24 12:13:58 +02:00
|
|
|
"github.com/mattermost/mattermost-server/v6/shared/filestore"
|
2020-10-16 16:36:08 +02:00
|
|
|
)
|
|
|
|
|
2021-06-11 14:24:51 +02:00
|
|
|
type Services struct {
|
2021-09-13 21:36:36 +02:00
|
|
|
Auth *auth.Auth
|
|
|
|
Store store.Store
|
|
|
|
FilesBackend filestore.FileBackend
|
|
|
|
Webhook *webhook.Client
|
|
|
|
Metrics *metrics.Metrics
|
|
|
|
Notifications *notify.Service
|
|
|
|
Logger *mlog.Logger
|
2021-06-04 16:38:49 +02:00
|
|
|
}
|
|
|
|
|
2020-10-16 16:21:42 +02:00
|
|
|
type App struct {
|
2021-09-13 21:36:36 +02:00
|
|
|
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
|
2020-10-16 19:12:53 +02:00
|
|
|
}
|
|
|
|
|
2021-09-16 21:31:02 +02:00
|
|
|
func (a *App) SetConfig(config *config.Configuration) {
|
|
|
|
a.config = config
|
|
|
|
}
|
|
|
|
|
2021-08-27 10:59:14 +02:00
|
|
|
func New(config *config.Configuration, wsAdapter ws.Adapter, services Services) *App {
|
2021-02-02 21:11:21 +01:00
|
|
|
return &App{
|
2021-09-13 21:36:36 +02:00
|
|
|
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,
|
2021-02-02 21:11:21 +01:00
|
|
|
}
|
2020-10-16 16:21:42 +02:00
|
|
|
}
|