From 0b1e798cfaf64450c7b2e5ae1aa6a63c6c53e1bf Mon Sep 17 00:00:00 2001 From: Benjamin Dornel Date: Tue, 17 Sep 2024 00:13:38 +0800 Subject: [PATCH] feat: add support for custom server address --- entrypoint.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/entrypoint.py b/entrypoint.py index 8af9150..64a2148 100644 --- a/entrypoint.py +++ b/entrypoint.py @@ -3,6 +3,11 @@ from pathlib import Path import streamlit.web.cli as stcli +from pydantic_settings import BaseSettings + + +class StreamlitConfig(BaseSettings): + browser_server_address: str = "localhost" def resolve_path(path: str) -> str: @@ -11,11 +16,12 @@ def resolve_path(path: str) -> str: if __name__ == "__main__": + config = StreamlitConfig() sys.argv = [ "streamlit", "run", resolve_path("webapp/app.py"), - "--browser.serverAddress=localhost", + f"--browser.serverAddress={config.browser_server_address}", "--browser.gatherUsageStats=false", "--client.toolbarMode=viewer", "--global.developmentMode=false",