mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-19 10:40:15 +00:00
chore: review comments
This commit is contained in:
@@ -85,12 +85,16 @@ func (docker *DockerService) GetLabels(appDomain string) (*model.App, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for appName, appLabels := range labels.Apps {
|
||||
// fist pass - try to find an exact match for the domain
|
||||
for _, appLabels := range labels.Apps {
|
||||
if appLabels.Config.Domain == appDomain {
|
||||
docker.log.App.Debug().Str("id", inspect.ID).Str("name", inspect.Name).Msg("Found matching container by domain")
|
||||
return &appLabels, nil
|
||||
}
|
||||
}
|
||||
|
||||
// second pass - if we didn't find a match by domain, try to find a match by app name (subdomain)
|
||||
for appName, appLabels := range labels.Apps {
|
||||
if strings.SplitN(appDomain, ".", 2)[0] == appName {
|
||||
docker.log.App.Debug().Str("id", inspect.ID).Str("name", inspect.Name).Msg("Found matching container by app name")
|
||||
return &appLabels, nil
|
||||
|
||||
Reference in New Issue
Block a user