Add server_notices config

This commit is contained in:
Till Faelligen 2022-02-10 18:45:33 +01:00
parent 9ac27cabc5
commit cfe6b2b9a7
3 changed files with 43 additions and 0 deletions

View file

@ -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

View file

@ -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"`

View file

@ -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