IP Whitelists for Frontend (with Docker- & Kubernetes-Provider Support)

This commit is contained in:
MaZderMind 2017-04-30 11:22:07 +02:00 committed by Ludovic Fernandez
parent 55f610422a
commit 5f0b215e90
16 changed files with 731 additions and 14 deletions

19
provider/string_util.go Normal file
View file

@ -0,0 +1,19 @@
package provider
import "strings"
// SplitAndTrimString splits separatedString at the comma character and trims each
// piece, filtering out empty pieces. Returns the list of pieces or nil if the input
// did not contain a non-empty piece.
func SplitAndTrimString(separatedString string) []string {
listOfStrings := strings.Split(separatedString, ",")
var trimmedListOfStrings []string
for _, s := range listOfStrings {
s = strings.TrimSpace(s)
if len(s) > 0 {
trimmedListOfStrings = append(trimmedListOfStrings, s)
}
}
return trimmedListOfStrings
}