mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
API setup refactoring (#1266)
* Start HTTP endpoint refactoring * Update SetupAndServeHTTP * Fix builds * Don't set up external listener if no address configured * TLS HTTP setup * Break apart client/federation/key/media muxes * Tweaks * Fix P2P demos * Fix media API routing * Review comments @Kegsay * Update sample config * Fix gobind build * Fix External -> Public in federation API test
This commit is contained in:
parent
820c56c165
commit
9677a95afc
49 changed files with 542 additions and 383 deletions
|
@ -9,8 +9,8 @@ type ClientAPI struct {
|
|||
Matrix *Global `yaml:"-"`
|
||||
Derived *Derived `yaml:"-"` // TODO: Nuke Derived from orbit
|
||||
|
||||
Listen Address `yaml:"listen"`
|
||||
Bind Address `yaml:"bind"`
|
||||
InternalAPI InternalAPIOptions `yaml:"internal_api"`
|
||||
ExternalAPI ExternalAPIOptions `yaml:"external_api"`
|
||||
|
||||
// If set disables new users from registering (except via shared
|
||||
// secrets)
|
||||
|
@ -37,8 +37,9 @@ type ClientAPI struct {
|
|||
}
|
||||
|
||||
func (c *ClientAPI) Defaults() {
|
||||
c.Listen = "localhost:7771"
|
||||
c.Bind = "localhost:7771"
|
||||
c.InternalAPI.Listen = "http://localhost:7771"
|
||||
c.InternalAPI.Connect = "http://localhost:7771"
|
||||
c.ExternalAPI.Listen = "http://[::]:8071"
|
||||
c.RegistrationSharedSecret = ""
|
||||
c.RecaptchaPublicKey = ""
|
||||
c.RecaptchaPrivateKey = ""
|
||||
|
@ -49,8 +50,11 @@ func (c *ClientAPI) Defaults() {
|
|||
}
|
||||
|
||||
func (c *ClientAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||
checkNotEmpty(configErrs, "client_api.listen", string(c.Listen))
|
||||
checkNotEmpty(configErrs, "client_api.bind", string(c.Bind))
|
||||
checkURL(configErrs, "client_api.internal_api.listen", string(c.InternalAPI.Listen))
|
||||
checkURL(configErrs, "client_api.internal_api.connect", string(c.InternalAPI.Connect))
|
||||
if !isMonolith {
|
||||
checkURL(configErrs, "client_api.external_api.listen", string(c.ExternalAPI.Listen))
|
||||
}
|
||||
if c.RecaptchaEnabled {
|
||||
checkNotEmpty(configErrs, "client_api.recaptcha_public_key", string(c.RecaptchaPublicKey))
|
||||
checkNotEmpty(configErrs, "client_api.recaptcha_private_key", string(c.RecaptchaPrivateKey))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue