mirror of
https://github.com/TwiN/gatus.git
synced 2025-01-08 23:18:56 +01:00
refactor(alerting): Clean up Matrix code
This commit is contained in:
parent
38054f57e5
commit
f44d4055e6
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user