mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Add a new component: currentstateserver (#1171)
* Add a new component: currentstateserver - Add a skeleton for it, with databases and a single query method. - Add integration tests for it. - Add listen/address fields in the config (breaking as this will force people to specify this to validate) Not currently hooked up to anything yet. * Unbreak config tests * Add current_state to sample config * comments
This commit is contained in:
parent
3a18b7fc78
commit
ca5bbffd8d
19 changed files with 1293 additions and 3 deletions
|
@ -160,10 +160,13 @@ type Dendrite struct {
|
|||
// Postgres Config
|
||||
Database struct {
|
||||
// The Account database stores the login details and account information
|
||||
// for local users. It is accessed by the ClientAPI.
|
||||
// for local users. It is accessed by the UserAPI.
|
||||
Account DataSource `yaml:"account"`
|
||||
// The CurrentState database stores the current state of all rooms.
|
||||
// It is accessed by the CurrentStateServer.
|
||||
CurrentState DataSource `yaml:"current_state"`
|
||||
// The Device database stores session information for the devices of logged
|
||||
// in local users. It is accessed by the ClientAPI, the MediaAPI and the SyncAPI.
|
||||
// in local users. It is accessed by the UserAPI.
|
||||
Device DataSource `yaml:"device"`
|
||||
// The MediaAPI database stores information about files uploaded and downloaded
|
||||
// by local users. It is only accessed by the MediaAPI.
|
||||
|
@ -222,6 +225,7 @@ type Dendrite struct {
|
|||
Bind struct {
|
||||
MediaAPI Address `yaml:"media_api"`
|
||||
ClientAPI Address `yaml:"client_api"`
|
||||
CurrentState Address `yaml:"current_state_server"`
|
||||
FederationAPI Address `yaml:"federation_api"`
|
||||
ServerKeyAPI Address `yaml:"server_key_api"`
|
||||
AppServiceAPI Address `yaml:"appservice_api"`
|
||||
|
@ -238,6 +242,7 @@ type Dendrite struct {
|
|||
Listen struct {
|
||||
MediaAPI Address `yaml:"media_api"`
|
||||
ClientAPI Address `yaml:"client_api"`
|
||||
CurrentState Address `yaml:"current_state_server"`
|
||||
FederationAPI Address `yaml:"federation_api"`
|
||||
ServerKeyAPI Address `yaml:"server_key_api"`
|
||||
AppServiceAPI Address `yaml:"appservice_api"`
|
||||
|
@ -601,6 +606,7 @@ func (config *Dendrite) checkDatabase(configErrs *configErrors) {
|
|||
checkNotEmpty(configErrs, "database.media_api", string(config.Database.MediaAPI))
|
||||
checkNotEmpty(configErrs, "database.sync_api", string(config.Database.SyncAPI))
|
||||
checkNotEmpty(configErrs, "database.room_server", string(config.Database.RoomServer))
|
||||
checkNotEmpty(configErrs, "database.current_state", string(config.Database.CurrentState))
|
||||
}
|
||||
|
||||
// checkListen verifies the parameters listen.* are valid.
|
||||
|
@ -613,6 +619,7 @@ func (config *Dendrite) checkListen(configErrs *configErrors) {
|
|||
checkNotEmpty(configErrs, "listen.edu_server", string(config.Listen.EDUServer))
|
||||
checkNotEmpty(configErrs, "listen.server_key_api", string(config.Listen.EDUServer))
|
||||
checkNotEmpty(configErrs, "listen.user_api", string(config.Listen.UserAPI))
|
||||
checkNotEmpty(configErrs, "listen.current_state_server", string(config.Listen.CurrentState))
|
||||
}
|
||||
|
||||
// checkLogging verifies the parameters logging.* are valid.
|
||||
|
@ -735,6 +742,15 @@ func (config *Dendrite) UserAPIURL() string {
|
|||
return "http://" + string(config.Listen.UserAPI)
|
||||
}
|
||||
|
||||
// CurrentStateAPIURL returns an HTTP URL for where the currentstateserver is listening.
|
||||
func (config *Dendrite) CurrentStateAPIURL() string {
|
||||
// Hard code the currentstateserver 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 "http://" + string(config.Listen.CurrentState)
|
||||
}
|
||||
|
||||
// EDUServerURL returns an HTTP URL for where the EDU server is listening.
|
||||
func (config *Dendrite) EDUServerURL() string {
|
||||
// Hard code the EDU server to talk HTTP for now.
|
||||
|
@ -753,7 +769,7 @@ func (config *Dendrite) FederationSenderURL() string {
|
|||
return "http://" + string(config.Listen.FederationSender)
|
||||
}
|
||||
|
||||
// FederationSenderURL returns an HTTP URL for where the federation sender is listening.
|
||||
// ServerKeyAPIURL returns an HTTP URL for where the federation sender is listening.
|
||||
func (config *Dendrite) ServerKeyAPIURL() string {
|
||||
// Hard code the server key API server to talk HTTP for now.
|
||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||
|
|
|
@ -55,6 +55,7 @@ database:
|
|||
sync_api: "postgresql:///syn_api"
|
||||
room_server: "postgresql:///room_server"
|
||||
appservice: "postgresql:///appservice"
|
||||
current_state: "postgresql:///current_state"
|
||||
listen:
|
||||
room_server: "localhost:7770"
|
||||
client_api: "localhost:7771"
|
||||
|
@ -64,6 +65,7 @@ listen:
|
|||
appservice_api: "localhost:7777"
|
||||
edu_server: "localhost:7778"
|
||||
user_api: "localhost:7779"
|
||||
current_state_server: "localhost:7775"
|
||||
logging:
|
||||
- type: "file"
|
||||
level: "info"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue