Skip to content
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

Throw meaningful error when proxy config file does not exist #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion aws-replicator/aws_replicator/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ def cmd_aws_proxy(services: str, config: str, container: bool, port: int, host:

config_json: ProxyConfig = {"services": {}}
if config:
config_json = yaml.load(load_file(config), Loader=yaml.SafeLoader)
loaded_file = load_file(config)
if not loaded_file:
console.print(f"Config file {config} does not exist")
sys.exit(1)
Copy link
Member

@whummer whummer Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably better to use Context.exit here, so click can run any cleanup/shutdown logic, if any.

...
@click.pass_context
def cmd_aws_proxy(context, services: str, config: str, container: bool, port: int, host: str):
    from aws_replicator.client.auth_proxy import start_aws_auth_proxy_in_container
    
    if ...:
        ...
        context.exit(1)

config_json = yaml.load(loaded_file, Loader=yaml.SafeLoader)
if host:
config_json["bind_host"] = host
if services:
Expand Down
Loading