Skip to content

Commit

Permalink
simplification
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof authored and glours committed Jan 10, 2025
1 parent fa39503 commit e81de10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,11 @@ func (s *composeService) prepareContainerMACAddress(ctx context.Context, service
return macAddress, nil
}

func getAliases(project *types.Project, service types.ServiceConfig, serviceIndex int, networkKey string, useNetworkAliases bool) []string {
func getAliases(project *types.Project, service types.ServiceConfig, serviceIndex int, cfg *types.ServiceNetworkConfig, useNetworkAliases bool) []string {
aliases := []string{getContainerName(project.Name, service, serviceIndex)}
if useNetworkAliases {
aliases = append(aliases, service.Name)
if cfg := service.Networks[networkKey]; cfg != nil {
if cfg != nil {
aliases = append(aliases, cfg.Aliases...)
}
}
Expand Down Expand Up @@ -456,7 +456,7 @@ func createEndpointSettings(p *types.Project, service types.ServiceConfig, servi
driverOpts = config.DriverOpts
}
return &network.EndpointSettings{
Aliases: getAliases(p, service, serviceIndex, networkKey, useNetworkAliases),
Aliases: getAliases(p, service, serviceIndex, config, useNetworkAliases),
Links: links,
IPAddress: ipv4Address,
IPv6Gateway: ipv6Address,
Expand Down

0 comments on commit e81de10

Please sign in to comment.