diff options
-rw-r--r-- | swiftstory/SwiftStory.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/swiftstory/SwiftStory.py b/swiftstory/SwiftStory.py index 196c3dc..e77363d 100644 --- a/swiftstory/SwiftStory.py +++ b/swiftstory/SwiftStory.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import argparse import asyncio import websockets @@ -68,7 +69,12 @@ async def swiftstory(websocket, path): def main(): - start_server = websockets.serve(swiftstory, '0.0.0.0', 1236) + parser = argparse.ArgumentParser() + parser.add_argument('--listen', type=str, default='0.0.0.0') + parser.add_argument('--port', type=int, default=1236) + args = vars(parser.parse_args()) + + start_server = websockets.serve(swiftstory, args['listen'], args['port']) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() |