Various other refactoring

This commit is contained in:
Neil Alexander 2021-07-14 14:06:14 +01:00
parent 8f40e8fd5e
commit 48322bc2b2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
12 changed files with 25 additions and 16 deletions

View file

@ -296,6 +296,8 @@ func (config *Dendrite) Derive() error {
func (c *Dendrite) Defaults() {
c.Version = 1
c.Wiring()
c.Global.Defaults()
c.ClientAPI.Defaults()
c.EDUServer.Defaults()
@ -309,8 +311,6 @@ func (c *Dendrite) Defaults() {
c.UserAPI.Defaults()
c.AppServiceAPI.Defaults()
c.MSCs.Defaults()
c.Wiring()
}
func (c *Dendrite) Verify(configErrs *ConfigErrors, isMonolith bool) {

View file

@ -5,21 +5,26 @@ import "fmt"
type JetStream struct {
Matrix *Global `yaml:"-"`
// Persistent directory to store JetStream streams in.
StoragePath Path `yaml:"storage_path"`
// A list of NATS addresses to connect to. If none are specified, an
// internal NATS server will be used when running in monolith mode only.
Addresses []string `yaml:"addresses"`
// The prefix to use for stream names for this homeserver - really only
// useful if running more than one Dendrite on the same NATS deployment.
TopicPrefix string `yaml:"topic_prefix"`
// Keep all storage in memory. This is mostly useful for unit tests.
InMemory bool `yaml:"-"`
}
func (k *JetStream) TopicFor(name string) string {
return fmt.Sprintf("%s%s", k.TopicPrefix, name)
func (c *JetStream) TopicFor(name string) string {
return fmt.Sprintf("%s%s", c.TopicPrefix, name)
}
func (c *JetStream) Defaults() {
c.Addresses = []string{}
c.TopicPrefix = "Dendrite"
c.StoragePath = Path(fmt.Sprintf("./%s", c.Matrix.ServerName))
}
func (c *JetStream) Verify(configErrs *ConfigErrors, isMonolith bool) {