Merge host and port config into listen

This commit is contained in:
syeopite 2021-06-05 08:57:28 -07:00
parent 96e780e88e
commit ca5627516a
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
2 changed files with 6 additions and 6 deletions

View file

@ -20,10 +20,8 @@ Will use HTTP/3 to query the specified URL with the specified data, method and h
The port and address can be changed in config.toml, located in the default OS config location.
```toml
# Host address to bind to
host = "0.0.0.0"
# Port to listen on
port = 7192
# Host address to listen on
listen = "0.0.0.0:7192"
# Amount of workers to process quic requests
open_connections = 5
```

View file

@ -23,7 +23,7 @@ CONFIG_FILE.touch(exist_ok=True)
with open(f"{CONFIG_FILE}") as config:
config = pytomlpp.loads(config.read())
if not config:
config = {"port": 7192, "host": "0.0.0.0", "open_connections": 5}
config = {"listen": "0.0.0.0:7192", "open_connections": 5}
routes = web.RouteTableDef()
@ -78,4 +78,6 @@ async def main():
request_processor = quicclient.RequestProcessor()
if __name__ == '__main__':
process_cli_args()
web.run_app(main(), port=config.get("port", 7912), host=config.get("host", "0.0.0.0"))
address, port = config.get("listen", "0.0.0.0:7912").split(":")
web.run_app(main(), port=port, host=address)