Skip to content

Commit 0be5685

Browse files
authored
Add version number output to the startup CLI (#820)
1 parent 3efca8a commit 0be5685

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

backend/cli.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ def run(host: str, port: int, reload: bool, workers: int) -> None:
4747
openapi_url = url + (settings.FASTAPI_OPENAPI_URL or '')
4848

4949
panel_content = Text()
50-
panel_content.append(f'📝 Swagger 文档: {docs_url}\n', style='blue')
51-
panel_content.append(f'📚 Redoc 文档: {redoc_url}\n', style='yellow')
52-
panel_content.append(f'📡 OpenAPI JSON: {openapi_url}\n', style='green')
53-
panel_content.append(
54-
'🌍 fba 官方文档: https://fastapi-practices.github.io/fastapi_best_architecture_docs/',
55-
style='cyan',
56-
)
50+
panel_content.append(f'当前版本: v{__version__}')
51+
panel_content.append(f'\n服务地址: {url}')
52+
panel_content.append('\n官方文档: https://fastapi-practices.github.io/fastapi_best_architecture_docs/')
53+
54+
if settings.ENVIRONMENT == 'dev':
55+
panel_content.append(f'\n\n📖 Swagger 文档: {docs_url}', style='yellow')
56+
panel_content.append(f'\n📚 Redoc 文档: {redoc_url}', style='blue')
57+
panel_content.append(f'\n📡 OpenAPI JSON: {openapi_url}', style='green')
5758

5859
console.print(Panel(panel_content, title='fba 服务信息', border_style='purple', padding=(1, 2)))
5960
granian.Granian(

0 commit comments

Comments
 (0)