2021-01-28 00:25:37 +01:00
|
|
|
package util
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2021-10-23 22:47:12 +02:00
|
|
|
// ConvertGroupAndEndpointNameToKey converts a group and an endpoint to a key
|
2021-12-14 01:23:35 +01:00
|
|
|
func ConvertGroupAndEndpointNameToKey(groupName, endpointName string) string {
|
|
|
|
return sanitize(groupName) + "_" + sanitize(endpointName)
|
2021-01-28 00:25:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func sanitize(s string) string {
|
|
|
|
s = strings.TrimSpace(strings.ToLower(s))
|
|
|
|
s = strings.ReplaceAll(s, "/", "-")
|
|
|
|
s = strings.ReplaceAll(s, "_", "-")
|
|
|
|
s = strings.ReplaceAll(s, ".", "-")
|
|
|
|
s = strings.ReplaceAll(s, ",", "-")
|
|
|
|
s = strings.ReplaceAll(s, " ", "-")
|
|
|
|
return s
|
|
|
|
}
|