mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-22 16:58:54 +02:00
fix(label): expand wildcard labels before unmarshaling and add corresponding test
This commit is contained in:
@@ -127,8 +127,6 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container)
|
||||
m, err := docker.ParseLabels(container.Labels)
|
||||
errs.Add(err)
|
||||
|
||||
var wildcardProps docker.LabelMap
|
||||
|
||||
for alias, entryMapAny := range m {
|
||||
if len(alias) == 0 {
|
||||
errs.Add(gperr.New("empty alias"))
|
||||
@@ -150,11 +148,6 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container)
|
||||
}
|
||||
}
|
||||
|
||||
if alias == docker.WildcardAlias {
|
||||
wildcardProps = entryMap
|
||||
continue
|
||||
}
|
||||
|
||||
// check if it is an alias reference
|
||||
switch alias[0] {
|
||||
case aliasRefPrefix, aliasRefPrefixAlt:
|
||||
@@ -189,14 +182,6 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container)
|
||||
routes[alias] = r
|
||||
}
|
||||
}
|
||||
if wildcardProps != nil {
|
||||
for _, re := range routes {
|
||||
if err := serialization.MapUnmarshalValidate(wildcardProps, re); err != nil {
|
||||
errs.Add(err.Subject(docker.WildcardAlias))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return routes, errs.Error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user