Skip to content

Commit

Permalink
feat(api): CLI: add --host, --port
Browse files Browse the repository at this point in the history
  • Loading branch information
yzqzss committed Oct 30, 2023
1 parent 04edd49 commit 9750899
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions biliarchiver/cli_tools/biliarchiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,19 @@ def auth():


@biliarchiver.command(help=click.style(_("运行 API"), fg="cyan"))
def api():
@click.option(
"--host",
type=str,
default="127.0.0.1",
show_default=True,
)
@click.option(
"--port",
type=int,
default=8000,
show_default=True,
)
def api(**kwargs):
try:
import fastapi
import uvicorn
Expand All @@ -93,7 +105,7 @@ def api():

from biliarchiver.rest_api.main import app

uvicorn.run(app)
uvicorn.run(app, **kwargs)


if __name__ == "__main__":
Expand Down

0 comments on commit 9750899

Please sign in to comment.