From f44d4055e62a435f0f7ff8309e357ea2fbe3645c Mon Sep 17 00:00:00 2001 From: TwiN Date: Mon, 19 Sep 2022 22:08:18 -0400 Subject: [PATCH] refactor(alerting): Clean up Matrix code --- alerting/provider/matrix/matrix.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/alerting/provider/matrix/matrix.go b/alerting/provider/matrix/matrix.go index 0c234243..7567d3c8 100644 --- a/alerting/provider/matrix/matrix.go +++ b/alerting/provider/matrix/matrix.go @@ -159,31 +159,21 @@ func (provider *AlertProvider) getConfigForGroup(group string) MatrixProviderCon if provider.Overrides != nil { for _, override := range provider.Overrides { if group == override.Group { - return MatrixProviderConfig{ - ServerURL: override.ServerURL, - AccessToken: override.AccessToken, - InternalRoomID: override.InternalRoomID, - } + return override.MatrixProviderConfig } } } - return MatrixProviderConfig{ - ServerURL: provider.ServerURL, - AccessToken: provider.AccessToken, - InternalRoomID: provider.InternalRoomID, - } + return provider.MatrixProviderConfig } func randStringBytes(n int) string { // All the compatible characters to use in a transaction ID const availableCharacterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" - b := make([]byte, n) rand.Seed(time.Now().UnixNano()) for i := range b { b[i] = availableCharacterBytes[rand.Intn(len(availableCharacterBytes))] } - return string(b) }