1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-12 09:04:14 +02:00
focalboard/server/server/params.go
2021-09-13 15:36:36 -04:00

47 lines
1.0 KiB
Go

package server
import (
"fmt"
"github.com/mattermost/focalboard/server/services/config"
"github.com/mattermost/focalboard/server/services/notify"
"github.com/mattermost/focalboard/server/services/store"
"github.com/mattermost/focalboard/server/ws"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
type Params struct {
Cfg *config.Configuration
SingleUserToken string
DBStore store.Store
Logger *mlog.Logger
ServerID string
WSAdapter ws.Adapter
NotifyBackends []notify.Backend
}
func (p Params) CheckValid() error {
if p.Cfg == nil {
return ErrServerParam{name: "Cfg", issue: "cannot be nil"}
}
if p.DBStore == nil {
return ErrServerParam{name: "DbStore", issue: "cannot be nil"}
}
if p.Logger == nil {
return ErrServerParam{name: "Logger", issue: "cannot be nil"}
}
return nil
}
type ErrServerParam struct {
name string
issue string
}
func (e ErrServerParam) Error() string {
return fmt.Sprintf("invalid server params: %s %s", e.name, e.issue)
}