@@ -474,7 +474,7 @@ def _ssl_files_present() -> bool:
474474 return bool (SSL_CERT_FILE ) and os .path .isfile (SSL_CERT_FILE ) and bool (SSL_KEY_FILE ) and os .path .isfile (SSL_KEY_FILE )
475475
476476
477- _ui_tls_env = os . getenv ("TG_UI_TLS_ENABLED" , "" ).lower ()
477+ _ui_tls_env = getenv ("TG_UI_TLS_ENABLED" , "" ).lower ()
478478UI_TLS_ENABLED : bool = _ui_tls_env in ("yes" , "true" ) if _ui_tls_env else _ssl_files_present ()
479479"""
480480Enable TLS for the Streamlit UI server.
@@ -484,7 +484,7 @@ def _ssl_files_present() -> bool:
484484defaults to: auto-detect
485485"""
486486
487- _api_tls_env = os . getenv ("TG_API_TLS_ENABLED" , "" ).lower ()
487+ _api_tls_env = getenv ("TG_API_TLS_ENABLED" , "" ).lower ()
488488API_TLS_ENABLED : bool = _api_tls_env in ("yes" , "true" ) if _api_tls_env else _ssl_files_present ()
489489"""
490490Enable TLS for the API/MCP server (uvicorn).
@@ -568,23 +568,23 @@ def _ssl_files_present() -> bool:
568568defaults to: `yes`
569569"""
570570
571- UI_PORT : int = int (os . getenv ("TG_UI_PORT" , "8501" ))
571+ UI_PORT : int = int (getenv ("TG_UI_PORT" , "8501" ))
572572"""
573573Port for the UI server.
574574
575575from env variable: `TG_UI_PORT`
576576defaults to: `8501`
577577"""
578578
579- API_PORT : int = int (os . getenv ("TG_API_PORT" , "8530" ))
579+ API_PORT : int = int (getenv ("TG_API_PORT" , "8530" ))
580580"""
581581Port for the API server.
582582
583583from env variable: `TG_API_PORT`
584584defaults to: `8530`
585585"""
586586
587- API_HOST : str = os . getenv ("TG_API_HOST" , "0.0.0.0" ) # noqa: S104
587+ API_HOST : str = getenv ("TG_API_HOST" , "0.0.0.0" ) # noqa: S104
588588"""
589589Host for the API server.
590590
@@ -597,7 +597,7 @@ def _default_base_url() -> str:
597597 return f"{ scheme } ://localhost:{ API_PORT } "
598598
599599
600- BASE_URL : str = os . getenv ("TG_BASE_URL" , "" ) or _default_base_url ()
600+ BASE_URL : str = getenv ("TG_BASE_URL" , "" ) or _default_base_url ()
601601"""
602602Externally-reachable base URL for the API/MCP/OAuth server.
603603
@@ -608,14 +608,13 @@ def _default_base_url() -> str:
608608
609609def _default_ui_base_url () -> str :
610610 scheme = "https" if UI_TLS_ENABLED else "http"
611- port = os .getenv ("STREAMLIT_SERVER_PORT" , "8501" )
612- return f"{ scheme } ://localhost:{ port } "
611+ return f"{ scheme } ://localhost:{ UI_PORT } "
613612
614613
615- UI_BASE_URL : str = os . getenv ("TG_UI_BASE_URL" , "" ) or _default_ui_base_url ()
614+ UI_BASE_URL : str = getenv ("TG_UI_BASE_URL" , "" ) or _default_ui_base_url ()
616615"""
617616Externally-reachable base URL for the Streamlit UI (used in email links, PDFs).
618617
619618from env variable: `TG_UI_BASE_URL`
620- defaults to: computed from UI_TLS_ENABLED and STREAMLIT_SERVER_PORT
619+ defaults to: computed from UI_TLS_ENABLED and UI_PORT
621620"""
0 commit comments