Refactor frontends rules
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
dd160dc342
commit
8737530a7d
24 changed files with 198 additions and 222 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/BurntSushi/toml"
|
||||
"github.com/containous/traefik/autogen"
|
||||
"github.com/containous/traefik/types"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
// Provider defines methods of a provider.
|
||||
|
@ -67,3 +68,11 @@ func replace(s1 string, s2 string, s3 string) string {
|
|||
func getEscapedName(name string) string {
|
||||
return strings.Replace(strings.TrimPrefix(name, "/"), "/", "-", -1)
|
||||
}
|
||||
|
||||
func normalize(name string) string {
|
||||
fargs := func(c rune) bool {
|
||||
return !unicode.IsLetter(c) && !unicode.IsNumber(c)
|
||||
}
|
||||
// get function
|
||||
return strings.Join(strings.FieldsFunc(name, fargs), "-")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue