diff --git a/dendrite-config.yaml b/dendrite-config.yaml index 38b146d70..8529d7ba2 100644 --- a/dendrite-config.yaml +++ b/dendrite-config.yaml @@ -68,6 +68,17 @@ global: # to other servers and the federation API will not be exposed. disable_federation: false + # Server notices allows server admins to send messages to all users. + server_notices: + # The server localpart to be used when sending notices, ensure this is not yet take + local_part: "server" + # The displayname to be used when sending notices + display_name: "Server alerts" + # The avatar of this user + avatar: "" + # The roomname to be used when creating messages + room_name: "Server Alerts" + # Configuration for NATS JetStream jetstream: # A list of NATS Server addresses to connect to. If none are specified, an diff --git a/setup/config/config_global.go b/setup/config/config_global.go index 6f2306a6d..526e0bc6a 100644 --- a/setup/config/config_global.go +++ b/setup/config/config_global.go @@ -57,6 +57,9 @@ type Global struct { // DNS caching options for all outbound HTTP requests DNSCache DNSCacheOptions `yaml:"dns_cache"` + + // ServerNotices configuration used for sending server notices + ServerNotices ServerNotices `yaml:"server_notices"` } func (c *Global) Defaults(generate bool) { @@ -82,6 +85,7 @@ func (c *Global) Verify(configErrs *ConfigErrors, isMonolith bool) { c.Metrics.Verify(configErrs, isMonolith) c.Sentry.Verify(configErrs, isMonolith) c.DNSCache.Verify(configErrs, isMonolith) + c.ServerNotices.Verify(configErrs, isMonolith) } type OldVerifyKeys struct { @@ -123,6 +127,29 @@ func (c *Metrics) Defaults(generate bool) { func (c *Metrics) Verify(configErrs *ConfigErrors, isMonolith bool) { } +// ServerNotices defines the configuration used for sending server notices +type ServerNotices struct { + // The localpart to be used when sending notices + LocalPart string `yaml:"local_part"` + // The displayname to be used when sending notices + DisplayName string `yaml:"display_name"` + // The avatar of this user + Avatar string `yaml:"avatar"` + // The roomname to be used when creating messages + RoomName string `yaml:"room_name"` +} + +func (c *ServerNotices) Defaults(generate bool) { + if generate { + c.LocalPart = "server" + c.DisplayName = "Server Alert" + c.RoomName = "Server Alert" + c.Avatar = "" + } +} + +func (c *ServerNotices) Verify(errors *ConfigErrors, isMonolith bool) {} + // The configuration to use for Sentry error reporting type Sentry struct { Enabled bool `yaml:"enabled"` diff --git a/setup/config/config_test.go b/setup/config/config_test.go index 5aa54929e..8a012a7f0 100644 --- a/setup/config/config_test.go +++ b/setup/config/config_test.go @@ -58,6 +58,11 @@ global: basic_auth: username: metrics password: metrics + server_notices: + local_part: "server" + display_name: "Server alerts" + avatar: "" + room_name: "Server Alerts" app_service_api: internal_api: listen: http://localhost:7777