-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
27 lines (21 loc) · 769 Bytes
/
Copy path__main__.py
File metadata and controls
27 lines (21 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""thin-controller main"""
import click
import uvicorn
@click.command()
@click.option("--reload", is_flag=True, help="Enable auto-reload")
@click.option("--host", default="localhost", help="Host to run the server on")
@click.option("--port", default=8000, help="Port to run the server on")
def cli(reload: bool = False, host: str = "localhost", port: int = 8000) -> None:
"""Run the Thin Controller server"""
if reload:
uvicorn.run(
"thin_controller:app",
host=host,
port=port,
reload=True,
reload_dirs=["thin_controller"], # because watching too much gets hungry
)
else:
uvicorn.run("thin_controller:app", host=host, port=port)
if __name__ == "__main__":
cli()