mirror of
https://github.com/docker/compose.git
synced 2025-07-16 18:24:26 +02:00
Merge pull request #8972 from ulyssessouza/fix-links-resolution2
Refactoring variable name
This commit is contained in:
commit
025a72a417
@ -489,9 +489,9 @@ func (s composeService) getLinks(ctx context.Context, projectName string, servic
|
|||||||
for _, rawLink := range service.Links {
|
for _, rawLink := range service.Links {
|
||||||
linkSplit := strings.Split(rawLink, ":")
|
linkSplit := strings.Split(rawLink, ":")
|
||||||
linkServiceName := linkSplit[0]
|
linkServiceName := linkSplit[0]
|
||||||
l := linkServiceName
|
linkName := linkServiceName
|
||||||
if len(linkSplit) == 2 {
|
if len(linkSplit) == 2 {
|
||||||
l = linkSplit[1] // linkName if informed like in: "serviceName:linkName"
|
linkName = linkSplit[1] // linkName if informed like in: "serviceName:linkName"
|
||||||
}
|
}
|
||||||
cnts, err := getServiceContainers(linkServiceName)
|
cnts, err := getServiceContainers(linkServiceName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -500,7 +500,7 @@ func (s composeService) getLinks(ctx context.Context, projectName string, servic
|
|||||||
for _, c := range cnts {
|
for _, c := range cnts {
|
||||||
containerName := getCanonicalContainerName(c)
|
containerName := getCanonicalContainerName(c)
|
||||||
links = append(links,
|
links = append(links,
|
||||||
format(containerName, l),
|
format(containerName, linkName),
|
||||||
format(containerName, strings.Join([]string{linkServiceName, strconv.Itoa(number)}, Separator)),
|
format(containerName, strings.Join([]string{linkServiceName, strconv.Itoa(number)}, Separator)),
|
||||||
format(containerName, strings.Join([]string{projectName, linkServiceName, strconv.Itoa(number)}, Separator)),
|
format(containerName, strings.Join([]string{projectName, linkServiceName, strconv.Itoa(number)}, Separator)),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user