mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 05:43:09 -06:00
Further tweaks
This commit is contained in:
parent
65cae7a8f4
commit
d6a6b27c5c
|
|
@ -92,11 +92,11 @@ func MustWriteOutputEvent(t *testing.T, producer sarama.SyncProducer, out *rooms
|
|||
}
|
||||
|
||||
func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.SyncProducer) {
|
||||
cfg := &config.CurrentStateServer{
|
||||
Matrix: &config.Global{},
|
||||
}
|
||||
cfg.Matrix.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic)
|
||||
cfg.Database = config.DataSource("file::memory:")
|
||||
cfg := &config.Dendrite{}
|
||||
cfg.Defaults()
|
||||
cfg.Global.ServerName = "kaer.morhen"
|
||||
cfg.Global.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic)
|
||||
cfg.CurrentStateServer.Database = config.DataSource("file::memory:")
|
||||
db, err := sqlutil.Open(sqlutil.SQLiteDriverName(), "file::memory:", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open naffka database: %s", err)
|
||||
|
|
@ -109,7 +109,7 @@ func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.Sync
|
|||
if err != nil {
|
||||
t.Fatalf("Failed to create naffka consumer: %s", err)
|
||||
}
|
||||
return NewInternalAPI(cfg, naff), naff
|
||||
return NewInternalAPI(&cfg.CurrentStateServer, naff), naff
|
||||
}
|
||||
|
||||
func TestQueryCurrentState(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ type FederationSender struct {
|
|||
// The default value is 16 if not specified, which is circa 18 hours.
|
||||
FederationMaxRetries uint32 `yaml:"federation_max_retries"`
|
||||
|
||||
Proxy Proxy `yaml:"proxy"`
|
||||
Proxy Proxy `yaml:"proxy_outbound"`
|
||||
}
|
||||
|
||||
func (c *FederationSender) Defaults() {
|
||||
|
|
@ -27,6 +27,8 @@ func (c *FederationSender) Defaults() {
|
|||
c.DatabaseOptions.Defaults()
|
||||
|
||||
c.FederationMaxRetries = 16
|
||||
|
||||
c.Proxy.Defaults()
|
||||
}
|
||||
|
||||
func (c *FederationSender) Verify(configErrs *configErrors) {
|
||||
|
|
@ -37,6 +39,8 @@ func (c *FederationSender) Verify(configErrs *configErrors) {
|
|||
|
||||
// The config for setting a proxy to use for server->server requests
|
||||
type Proxy struct {
|
||||
// Is the proxy enabled?
|
||||
Enabled bool `yaml:"enabled"`
|
||||
// The protocol for the proxy (http / https / socks5)
|
||||
Protocol string `yaml:"protocol"`
|
||||
// The host where the proxy is listening
|
||||
|
|
@ -46,9 +50,10 @@ type Proxy struct {
|
|||
}
|
||||
|
||||
func (c *Proxy) Defaults() {
|
||||
c.Protocol = ""
|
||||
c.Host = ""
|
||||
c.Port = 0
|
||||
c.Enabled = false
|
||||
c.Protocol = "http"
|
||||
c.Host = "localhost"
|
||||
c.Port = 8080
|
||||
}
|
||||
|
||||
func (c *Proxy) Verify(configErrs *configErrors) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ const testConfig = `
|
|||
version: 1
|
||||
global:
|
||||
server_name: localhost
|
||||
private_key: matrix.pem
|
||||
private_key: matrix_key.pem
|
||||
key_validity_period: 168h0m0s
|
||||
trusted_third_party_id_servers: []
|
||||
kafka:
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package setup
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -107,15 +108,12 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, useHTTPAPIs boo
|
|||
}
|
||||
|
||||
client := http.Client{Timeout: HTTPClientTimeout}
|
||||
// TODO: fix this
|
||||
/*
|
||||
if cfg.Proxy != nil {
|
||||
if cfg.FederationSender.Proxy.Enabled {
|
||||
client.Transport = &http.Transport{Proxy: http.ProxyURL(&url.URL{
|
||||
Scheme: cfg.Proxy.Protocol,
|
||||
Host: fmt.Sprintf("%s:%d", cfg.Proxy.Host, cfg.Proxy.Port),
|
||||
Scheme: cfg.FederationSender.Proxy.Protocol,
|
||||
Host: fmt.Sprintf("%s:%d", cfg.FederationSender.Proxy.Host, cfg.FederationSender.Proxy.Port),
|
||||
})}
|
||||
}
|
||||
*/
|
||||
|
||||
// Ideally we would only use SkipClean on routes which we know can allow '/' but due to
|
||||
// https://github.com/gorilla/mux/issues/460 we have to attach this at the top router.
|
||||
|
|
|
|||
Loading…
Reference in a new issue