Skip to content

Commit

Permalink
Avoid inline hardcoded defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
anchal00 committed Aug 16, 2024
1 parent 02be10e commit 4286e48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions optimus/cli/optimus.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@


def main(argv):
DEFAULT_WORKER_THREADS = 10
DEFAULT_PORT = 53

arg_parser = ArgumentParser(
prog="Optimus",
description="A toy DNS server made for fun ;)",
Expand All @@ -16,15 +19,15 @@ def main(argv):
"-p",
metavar="PORT",
type=int,
default=53,
help="Port to run the server on (defaults to 53)",
default=DEFAULT_PORT,
help=f"Port to run the server on (defaults to {DEFAULT_PORT})",
)
arg_parser.add_argument(
"-t",
metavar="THREADS",
type=int,
default=100,
help="Number of worker threads to spin up for handling requests (defaults to 100)",
default=DEFAULT_WORKER_THREADS,
help=f"Number of worker threads to spin up for handling requests (defaults to {DEFAULT_WORKER_THREADS})",
)
arg_parser.add_argument("-v", action="store_true", help="Get version info")
args = arg_parser.parse_args(argv)
Expand Down

0 comments on commit 4286e48

Please sign in to comment.