From 933594b059d14a900ce60db4c8fd11115dd3da84 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Nov 2019 15:25:46 +0100 Subject: [PATCH] 5.0a85 --- royalnet/__main__.py | 5 ++++- royalnet/version.py | 2 +- royalnet/web/constellation.py | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/royalnet/__main__.py b/royalnet/__main__.py index 9d6543a8..57cd0367 100644 --- a/royalnet/__main__.py +++ b/royalnet/__main__.py @@ -15,6 +15,8 @@ import logging help="Enable/disable the Discord bot.") @click.option("--webserver/--no-webserver", default=None, help="Enable/disable the Web server.") +@click.option("--webserver-port", default=8001, + help="The port on which the web server will listen on.") @click.option("-d", "--database", type=str, default=None, help="The PostgreSQL database path.") @click.option("-p", "--packs", type=str, multiple=True, default=[], @@ -30,6 +32,7 @@ import logging def run(telegram: typing.Optional[bool], discord: typing.Optional[bool], webserver: typing.Optional[bool], + webserver_port: typing.Optional[int], database: typing.Optional[str], packs: typing.Tuple[str], network_address: typing.Optional[str], @@ -169,7 +172,7 @@ def run(telegram: typing.Optional[bool], tables=constellation_tables) webserver_process = multiprocessing.Process(name="Constellation Webserver", target=constellation.run_blocking, - args=(verbose,), + args=("0.0.0.0", webserver_port, verbose,), daemon=True) webserver_process.start() diff --git a/royalnet/version.py b/royalnet/version.py index dda2d1d6..88908bf1 100644 --- a/royalnet/version.py +++ b/royalnet/version.py @@ -1,4 +1,4 @@ -semantic = "5.0a84" +semantic = "5.0a85" if __name__ == "__main__": print(semantic) diff --git a/royalnet/web/constellation.py b/royalnet/web/constellation.py index 66e6c7a1..5819e353 100644 --- a/royalnet/web/constellation.py +++ b/royalnet/web/constellation.py @@ -79,7 +79,7 @@ class Constellation: def set_secret(self, username: str, password: str): return keyring.set_password(f"Royalnet/{self.secrets_name}", username, password) - def run_blocking(self, verbose): + def run_blocking(self, address: str, port: int, verbose: bool): if verbose: core_logger = logging.root core_logger.setLevel(logging.DEBUG) @@ -88,5 +88,5 @@ class Constellation: core_logger.addHandler(stream_handler) core_logger.debug("Logging setup complete.") self._init_sentry() - log.info("Running constellation server...") - uvicorn.run(self.starlette) + log.info(f"Running constellation server on {address}:{port}...") + uvicorn.run(self.starlette, host=address, port=port)