Skip to content

Commit 5f39707

Browse files
committed
fix: add default value
1 parent ef1d649 commit 5f39707

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/fastapi_cli/cli.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import importlib
22
from logging import getLogger
33
from pathlib import Path
4-
from typing import Any, Union
4+
from typing import Any, Final, Union
55

66
import typer
77
import uvicorn
@@ -16,6 +16,8 @@
1616
from . import __version__
1717
from .logging import setup_logging
1818

19+
DEFAULT_DOCS_URL: Final[str] = "/docs"
20+
1921
app = typer.Typer(rich_markup_mode="rich")
2022

2123
setup_logging()
@@ -50,7 +52,7 @@ def _get_docs_url(uvicorn_path: str) -> str:
5052
module_path, app_name = uvicorn_path.split(sep=":")
5153
module = importlib.import_module(module_path)
5254
app = getattr(module, app_name)
53-
return app.docs_url
55+
return app.docs_url or DEFAULT_DOCS_URL
5456

5557

5658
def _run(

0 commit comments

Comments
 (0)