Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Only add network aliases for the default network
Browse files Browse the repository at this point in the history
  • Loading branch information
seowalex committed Jan 2, 2024
1 parent 693134b commit c0ee8e6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.1] - 2024-01-02

### Changed
### Fixed

- Upgrade dependencies
- Only add network aliases for the default network.

## [0.2.0] - 2023-08-05

### Changed

- Upgrade dependencies
- Upgrade dependencies.

### Fixed

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ enum_variant_names = "allow"
large_enum_variant = "allow"
needless_pass_by_value = "allow"
struct_excessive_bools = "allow"
struct_field_names = "allow"
too_many_lines = "allow"
unnecessary_wraps = "allow"
7 changes: 5 additions & 2 deletions src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,6 @@ async fn create_containers(
project_name,
"--name",
&container_name,
"--network-alias",
service_name,
])
.chain(requirements.iter().flat_map(|requirement| {
["--requires", requirement]
Expand All @@ -470,6 +468,11 @@ async fn create_containers(
.iter()
.flat_map(|network| ["--network", network]),
)
.chain(if service.networks.contains_key("default") {
vec!["--network-alias", service_name]
} else {
vec![]
})
.chain(volumes.iter().map(AsRef::as_ref))
.chain(
secrets
Expand Down
7 changes: 5 additions & 2 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ async fn run_container(
project_name,
"--name",
&container_name,
"--network-alias",
&args.service,
])
.chain(
requirements
Expand All @@ -216,6 +214,11 @@ async fn run_container(
vec![]
})
.chain(networks.iter().flat_map(|network| ["--network", network]))
.chain(if service.networks.contains_key("default") {
vec!["--network-alias", &args.service]
} else {
vec![]
})
.chain(volumes.iter().map(AsRef::as_ref))
.chain(secrets.iter().flat_map(|secret| ["--secret", secret]))
.chain(if args.detach {
Expand Down

0 comments on commit c0ee8e6

Please sign in to comment.