Skip to content

Commit

Permalink
Fix a bug where not having any default URL breaks application start. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
terjekv authored Feb 20, 2024
1 parent 1f25a27 commit 2b452f3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mreg_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@ def main():

parser = argparse.ArgumentParser(description="The MREG cli")

# Accept empty url as the default option for the --url parameter.
# If the user never sets the URL we will throw a value error on
# the initial connection attempt.
default_url = ""
try:
default_url = config.get_url()
except ValueError:
pass

connect_args = parser.add_argument_group("connection settings")
connect_args.add_argument(
"--url",
default=config.get_url(),
default=default_url,
help="use mreg server at %(metavar)s (default: %(default)s)",
metavar="URL",
)
Expand Down

0 comments on commit 2b452f3

Please sign in to comment.