From 03fa5f99e43478b67cb8f7a5ff0ad82df33d8764 Mon Sep 17 00:00:00 2001 From: Sanskar Jethi Date: Sat, 5 Nov 2022 16:16:13 +0000 Subject: [PATCH 1/2] style: add logging for url port and host --- robyn/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/robyn/__init__.py b/robyn/__init__.py index a5051bad3..41f2e8202 100644 --- a/robyn/__init__.py +++ b/robyn/__init__.py @@ -113,6 +113,10 @@ def start(self, url: str = "127.0.0.1", port: int = 5000): url = os.getenv("ROBYN_URL", url) port = int(os.getenv("ROBYN_PORT", port)) + logger.info( + "%sStarting server at %s:%s %s", Colors.OKGREEN, url, port, Colors.ENDC + ) + def init_processpool(socket): process_pool = [] @@ -158,7 +162,6 @@ def init_processpool(socket): process_pool = init_processpool(socket) - logger.info(f"{Colors.HEADER}Starting up \n{Colors.ENDC}") logger.info(f"{Colors.OKGREEN}Press Ctrl + C to stop \n{Colors.ENDC}") try: for process in process_pool: From f999ad37e13dd931c410cf042ec520d9270bf86e Mon Sep 17 00:00:00 2001 From: Sanskar Jethi Date: Sat, 5 Nov 2022 16:18:41 +0000 Subject: [PATCH 2/2] test: improve test for allowing both robyn.env and positional parameter --- integration_tests/base_routes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/integration_tests/base_routes.py b/integration_tests/base_routes.py index 4c67830f9..697f3e18a 100644 --- a/integration_tests/base_routes.py +++ b/integration_tests/base_routes.py @@ -196,8 +196,6 @@ async def redirect_route(request): if __name__ == "__main__": - ROBYN_URL = os.getenv("ROBYN_URL", "0.0.0.0") - ROBYN_PORT = int(os.getenv("ROBYN_PORT", "5000")) app.add_header("server", "robyn") current_file_path = pathlib.Path(__file__).parent.resolve() app.add_directory( @@ -206,4 +204,4 @@ async def redirect_route(request): index_file="index.html", ) app.startup_handler(startup_handler) - app.start(port=ROBYN_PORT, url=ROBYN_URL) + app.start(port=5000)