Add Product Interfaces (#20403)
* app: improve plugin interfaces * add documentation * improve doc * add error id * add more info to readme
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7c1b8cd937
Коммит
39991d236b
@@ -96,6 +96,9 @@ const (
|
||||
UserKey ServiceKey = "user"
|
||||
PermissionsKey ServiceKey = "permissions"
|
||||
RouterKey ServiceKey = "router"
|
||||
BotKey ServiceKey = "bot"
|
||||
LogKey ServiceKey = "log"
|
||||
HooksKey ServiceKey = "hooks"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
@@ -394,8 +397,10 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
LicenseKey: s.licenseWrapper,
|
||||
FilestoreKey: s.filestore,
|
||||
ClusterKey: s.clusterWrapper,
|
||||
TeamKey: s.teamService,
|
||||
UserKey: s.userService,
|
||||
UserKey: New(ServerConnector(s.Channels())),
|
||||
LogKey: &logWrapper{
|
||||
srv: s,
|
||||
},
|
||||
}
|
||||
|
||||
// Step 8: Initialize products.
|
||||
@@ -1174,7 +1179,15 @@ func stripPort(hostport string) string {
|
||||
func (s *Server) Start() error {
|
||||
// Start products.
|
||||
// This needs to happen before because products are dependent on the HTTP server.
|
||||
|
||||
// make sure channels starts first
|
||||
if err := s.products["channels"].Start(); err != nil {
|
||||
return errors.Wrap(err, "Unable to start channels")
|
||||
}
|
||||
for name, product := range s.products {
|
||||
if name == "channels" {
|
||||
continue
|
||||
}
|
||||
if err := product.Start(); err != nil {
|
||||
return errors.Wrapf(err, "Unable to start %s", name)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user