mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Add push server component template
This commit is contained in:
parent
092edee210
commit
6843c3beee
22 changed files with 487 additions and 0 deletions
|
@ -51,6 +51,8 @@ import (
|
|||
fsinthttp "github.com/matrix-org/dendrite/federationsender/inthttp"
|
||||
keyserverAPI "github.com/matrix-org/dendrite/keyserver/api"
|
||||
keyinthttp "github.com/matrix-org/dendrite/keyserver/inthttp"
|
||||
pushserverAPI "github.com/matrix-org/dendrite/pushserver/api"
|
||||
psinthttp "github.com/matrix-org/dendrite/pushserver/inthttp"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
rsinthttp "github.com/matrix-org/dendrite/roomserver/inthttp"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
|
@ -277,6 +279,15 @@ func (b *BaseDendrite) KeyServerHTTPClient() keyserverAPI.KeyInternalAPI {
|
|||
return f
|
||||
}
|
||||
|
||||
// PushServerHTTPClient returns PushserverInternalAPI for hitting the push server over HTTP
|
||||
func (b *BaseDendrite) PushServerHTTPClient() pushserverAPI.PushserverInternalAPI {
|
||||
f, err := psinthttp.NewPushserverClient(b.Cfg.PushServerURL(), b.apiHttpClient)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Panic("PushServerHTTPClient failed", b.apiHttpClient)
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
// CreateAccountsDB creates a new instance of the accounts database. Should only
|
||||
// be called once per component.
|
||||
func (b *BaseDendrite) CreateAccountsDB() accounts.Database {
|
||||
|
|
|
@ -65,6 +65,7 @@ type Dendrite struct {
|
|||
SigningKeyServer SigningKeyServer `yaml:"signing_key_server"`
|
||||
SyncAPI SyncAPI `yaml:"sync_api"`
|
||||
UserAPI UserAPI `yaml:"user_api"`
|
||||
PushServer PushServer `yaml:"push_server"`
|
||||
|
||||
MSCs MSCs `yaml:"mscs"`
|
||||
|
||||
|
@ -308,6 +309,7 @@ func (c *Dendrite) Defaults() {
|
|||
c.SyncAPI.Defaults()
|
||||
c.UserAPI.Defaults()
|
||||
c.AppServiceAPI.Defaults()
|
||||
c.PushServer.Defaults()
|
||||
c.MSCs.Defaults()
|
||||
|
||||
c.Wiring()
|
||||
|
@ -340,6 +342,7 @@ func (c *Dendrite) Wiring() {
|
|||
c.SyncAPI.Matrix = &c.Global
|
||||
c.UserAPI.Matrix = &c.Global
|
||||
c.AppServiceAPI.Matrix = &c.Global
|
||||
c.PushServer.Matrix = &c.Global
|
||||
c.MSCs.Matrix = &c.Global
|
||||
|
||||
c.ClientAPI.Derived = &c.Derived
|
||||
|
@ -547,6 +550,15 @@ func (config *Dendrite) KeyServerURL() string {
|
|||
return string(config.KeyServer.InternalAPI.Connect)
|
||||
}
|
||||
|
||||
// PushServerURL returns an HTTP URL for where the push server is listening.
|
||||
func (config *Dendrite) PushServerURL() string {
|
||||
// Hard code the push server to talk HTTP for now.
|
||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||
// People setting up servers shouldn't need to get a certificate valid for the public
|
||||
// internet for an internal API.
|
||||
return string(config.PushServer.InternalAPI.Connect)
|
||||
}
|
||||
|
||||
// SetupTracing configures the opentracing using the supplied configuration.
|
||||
func (config *Dendrite) SetupTracing(serviceName string) (closer io.Closer, err error) {
|
||||
if !config.Tracing.Enabled {
|
||||
|
|
22
setup/config/config_pushserver.go
Normal file
22
setup/config/config_pushserver.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package config
|
||||
|
||||
type PushServer struct {
|
||||
Matrix *Global `yaml:"-"`
|
||||
|
||||
InternalAPI InternalAPIOptions `yaml:"internal_api"`
|
||||
|
||||
Database DatabaseOptions `yaml:"database"`
|
||||
}
|
||||
|
||||
func (c *PushServer) Defaults() {
|
||||
c.InternalAPI.Listen = "http://localhost:7783"
|
||||
c.InternalAPI.Connect = "http://localhost:7783"
|
||||
c.Database.Defaults(10)
|
||||
c.Database.ConnectionString = "file:pushserver.db"
|
||||
}
|
||||
|
||||
func (c *PushServer) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||
checkURL(configErrs, "room_server.internal_api.listen", string(c.InternalAPI.Listen))
|
||||
checkURL(configErrs, "room_server.internal_ap.bind", string(c.InternalAPI.Connect))
|
||||
checkNotEmpty(configErrs, "room_server.database.connection_string", string(c.Database.ConnectionString))
|
||||
}
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/internal/transactions"
|
||||
keyAPI "github.com/matrix-org/dendrite/keyserver/api"
|
||||
"github.com/matrix-org/dendrite/mediaapi"
|
||||
pushserverAPI "github.com/matrix-org/dendrite/pushserver/api"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/setup/process"
|
||||
|
@ -51,6 +52,7 @@ type Monolith struct {
|
|||
ServerKeyAPI serverKeyAPI.SigningKeyServerAPI
|
||||
UserAPI userapi.UserInternalAPI
|
||||
KeyAPI keyAPI.KeyInternalAPI
|
||||
PushserverAPI pushserverAPI.PushserverInternalAPI
|
||||
|
||||
// Optional
|
||||
ExtPublicRoomsProvider api.ExtraPublicRoomsProvider
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue