Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix config of port and url #302

Merged
merged 3 commits into from
Nov 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix the configure of port and url
fix the configure of port and url to look up robyn.env first
  • Loading branch information
kimhyun5u authored Nov 5, 2022
commit 4d590a61d511e6ab7ba45594df260597ef4f5f48
8 changes: 3 additions & 5 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,15 @@ def startup_handler(self, handler: Callable) -> None:
def shutdown_handler(self, handler: Callable) -> None:
self._add_event_handler(Events.SHUTDOWN, handler)

def start(self, url: str | None = None, port: int | None = None):
def start(self, url: str = "127.0.0.1", port: int = 5000):
"""
Starts the server

:param port int: reperesents the port number at which the server is listening
"""

if url is None:
url = os.getenv("ROBYN_URL", "127.0.0.1")
if port is None:
port = int(os.getenv("ROBYN_PORT", "5000"))
url = os.getenv("ROBYN_URL", url)
port = int(os.getenv("ROBYN_PORT", port))

def init_processpool(socket):

Expand Down