mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-25 15:51:55 -06:00
1e0e935699
Not 100% on how you would want to test this; you would need a NATS server configured with NKey: https://docs.nats.io/using-nats/developer/connecting/creds This was tested with Synadia's free NATS SaaS and it does appear to be working, however there's an issue with how NATS is used in general: ``` time="2024-09-10T14:40:05.105105731Z" level=fatal msg="Unable to add in-memory stream" error="nats: account requires a stream config to have max bytes set" stream=DendriteInputRoomEvent subjects="[DendriteInputRoomEvent DendriteInputRoomEvent.>]" ``` I tried creating the topic manually, however dendrite insists on deleting/recreating the topic, so getting this to work is an issue I'm going ot have to deal with later unless somebody gets to it before then. If you feel more competent than me and wanna draw from this PR as an example (if you have another way you'd prefer to see this done) go ahead feel free I just wanna see it get done and I'm not particularly good at working with golang. Signed-off-by: `Paige Thompson <paige@paige.bio>`
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
package config
|
|
|
|
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:"in_memory"`
|
|
// Disable logging. This is mostly useful for unit tests.
|
|
NoLog bool `yaml:"-"`
|
|
// Disables TLS validation. This should NOT be used in production
|
|
DisableTLSValidation bool `yaml:"disable_tls_validation"`
|
|
// A credentials file to be used for authentication, example:
|
|
// https://docs.nats.io/using-nats/developer/connecting/creds
|
|
Credentials Path `yaml:"credentials_path"`
|
|
}
|
|
|
|
func (c *JetStream) Prefixed(name string) string {
|
|
return fmt.Sprintf("%s%s", c.TopicPrefix, name)
|
|
}
|
|
|
|
func (c *JetStream) Durable(name string) string {
|
|
return c.Prefixed(name)
|
|
}
|
|
|
|
func (c *JetStream) Defaults(opts DefaultOpts) {
|
|
c.Addresses = []string{}
|
|
c.TopicPrefix = "Dendrite"
|
|
if opts.Generate {
|
|
c.StoragePath = Path("./")
|
|
c.NoLog = true
|
|
c.DisableTLSValidation = true
|
|
c.Credentials = Path("")
|
|
}
|
|
}
|
|
|
|
func (c *JetStream) Verify(configErrs *ConfigErrors) {}
|