Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1661a9f

Browse files
authored
configure MAIN_DOCKER_NETWORK automatically if --network flag is used (#8818)
1 parent af4620d commit 1661a9f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎localstack/cli/localstack.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,19 @@ def cmd_start(
455455
# pass the parsed cli params to the start infra command
456456
params = click.get_current_context().params
457457

458+
if network:
459+
# reconciles the network config and makes sure that MAIN_DOCKER_NETWORK is set automatically if
460+
# `--network` is set.
461+
if config.MAIN_DOCKER_NETWORK:
462+
if config.MAIN_DOCKER_NETWORK != network:
463+
raise click.ClickException(
464+
f"Values of MAIN_DOCKER_NETWORK={config.MAIN_DOCKER_NETWORK} and --network={network} "
465+
f"do not match"
466+
)
467+
else:
468+
config.MAIN_DOCKER_NETWORK = network
469+
os.environ["MAIN_DOCKER_NETWORK"] = network
470+
458471
if detached:
459472
bootstrap.start_infra_in_docker_detached(console, params)
460473
else:

0 commit comments

Comments
 (0)