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

Skip to content

configure MAIN_DOCKER_NETWORK automatically if --network flag is used #8818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions localstack/cli/localstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,19 @@ def cmd_start(
# pass the parsed cli params to the start infra command
params = click.get_current_context().params

if network:
# reconciles the network config and makes sure that MAIN_DOCKER_NETWORK is set automatically if
# `--network` is set.
if config.MAIN_DOCKER_NETWORK:
if config.MAIN_DOCKER_NETWORK != network:
raise click.ClickException(
f"Values of MAIN_DOCKER_NETWORK={config.MAIN_DOCKER_NETWORK} and --network={network} "
f"do not match"
)
else:
config.MAIN_DOCKER_NETWORK = network
os.environ["MAIN_DOCKER_NETWORK"] = network

if detached:
bootstrap.start_infra_in_docker_detached(console, params)
else:
Expand Down