Merge host and port config into listen
This commit is contained in:
parent
96e780e88e
commit
ca5627516a
|
@ -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.
|
The port and address can be changed in config.toml, located in the default OS config location.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Host address to bind to
|
# Host address to listen on
|
||||||
host = "0.0.0.0"
|
listen = "0.0.0.0:7192"
|
||||||
# Port to listen on
|
|
||||||
port = 7192
|
|
||||||
# Amount of workers to process quic requests
|
# Amount of workers to process quic requests
|
||||||
open_connections = 5
|
open_connections = 5
|
||||||
```
|
```
|
||||||
|
|
6
main.py
6
main.py
|
@ -23,7 +23,7 @@ CONFIG_FILE.touch(exist_ok=True)
|
||||||
with open(f"{CONFIG_FILE}") as config:
|
with open(f"{CONFIG_FILE}") as config:
|
||||||
config = pytomlpp.loads(config.read())
|
config = pytomlpp.loads(config.read())
|
||||||
if not config:
|
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()
|
routes = web.RouteTableDef()
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,4 +78,6 @@ async def main():
|
||||||
request_processor = quicclient.RequestProcessor()
|
request_processor = quicclient.RequestProcessor()
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
process_cli_args()
|
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)
|
||||||
|
|
Loading…
Reference in New Issue