mirror of
https://github.com/TwiN/gatus.git
synced 2025-01-09 07:28:29 +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 {
|
if provider.Overrides != nil {
|
||||||
for _, override := range provider.Overrides {
|
for _, override := range provider.Overrides {
|
||||||
if group == override.Group {
|
if group == override.Group {
|
||||||
return MatrixProviderConfig{
|
return override.MatrixProviderConfig
|
||||||
ServerURL: override.ServerURL,
|
|
||||||
AccessToken: override.AccessToken,
|
|
||||||
InternalRoomID: override.InternalRoomID,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MatrixProviderConfig{
|
return provider.MatrixProviderConfig
|
||||||
ServerURL: provider.ServerURL,
|
|
||||||
AccessToken: provider.AccessToken,
|
|
||||||
InternalRoomID: provider.InternalRoomID,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func randStringBytes(n int) string {
|
func randStringBytes(n int) string {
|
||||||
// All the compatible characters to use in a transaction ID
|
// All the compatible characters to use in a transaction ID
|
||||||
const availableCharacterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
const availableCharacterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
|
|
||||||
b := make([]byte, n)
|
b := make([]byte, n)
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
for i := range b {
|
for i := range b {
|
||||||
b[i] = availableCharacterBytes[rand.Intn(len(availableCharacterBytes))]
|
b[i] = availableCharacterBytes[rand.Intn(len(availableCharacterBytes))]
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(b)
|
return string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user