mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-22 16:22:55 +00:00
Co-Authored-By: Trong Huu Nguyen <trong.huu.nguyen@nav.no> Co-Authored-By: Kim Tore Jensen <kim.tore.jensen@nav.no>
29 lines
487 B
Go
29 lines
487 B
Go
package config
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
func ParseIngresses(ingresses []string) []string {
|
|
prefixMap := make(map[string]interface{})
|
|
|
|
for _, ingress := range ingresses {
|
|
ingressURL, err := url.Parse(ingress)
|
|
if err != nil {
|
|
continue
|
|
}
|
|
path := ingressURL.Path
|
|
path = strings.TrimRight(path, "/")
|
|
|
|
prefixMap[path] = new(interface{})
|
|
}
|
|
|
|
prefixes := make([]string, 0)
|
|
for prefix := range prefixMap {
|
|
prefixes = append(prefixes, prefix)
|
|
}
|
|
|
|
return prefixes
|
|
}
|