chore: review comments

This commit is contained in:
Stavros
2026-05-18 11:27:50 +03:00
parent f9fd457e28
commit eb0a925ea3
5 changed files with 84 additions and 32 deletions
+5 -1
View File
@@ -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