feat: set server_name to None to enable dual stack in web page

This commit is contained in:
Steven Moder 2025-01-16 02:02:08 +08:00
parent 8254930495
commit 3cb6b8e74f
1 changed files with 2 additions and 2 deletions

View File

@ -275,7 +275,7 @@ def start_app(app_block, CONCURRENT_COUNT, AUTHENTICATION, PORT, SSL_KEYFILE, SS
# --- --- uvicorn.Config --- --- # --- --- uvicorn.Config --- ---
ssl_keyfile = None if SSL_KEYFILE == "" else SSL_KEYFILE ssl_keyfile = None if SSL_KEYFILE == "" else SSL_KEYFILE
ssl_certfile = None if SSL_CERTFILE == "" else SSL_CERTFILE ssl_certfile = None if SSL_CERTFILE == "" else SSL_CERTFILE
server_name = "0.0.0.0" server_name = None
config = uvicorn.Config( config = uvicorn.Config(
fastapi_app, fastapi_app,
host=server_name, host=server_name,
@ -286,7 +286,7 @@ def start_app(app_block, CONCURRENT_COUNT, AUTHENTICATION, PORT, SSL_KEYFILE, SS
ssl_certfile=ssl_certfile, ssl_certfile=ssl_certfile,
) )
server = Server(config) server = Server(config)
url_host_name = "localhost" if server_name == "0.0.0.0" else server_name url_host_name = "localhost" if server_name is None else server_name
if ssl_keyfile is not None: if ssl_keyfile is not None:
if ssl_certfile is None: if ssl_certfile is None:
raise ValueError( raise ValueError(