File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,13 +84,27 @@ def _is_truthy(v: str | None) -> bool:
8484 return str (v ).strip ().lower () in {"1" , "true" , "yes" , "on" }
8585
8686
87+ def _setting (name : str ) -> str | None :
88+ # Prefer real environment variables, then Streamlit secrets for Cloud deploys.
89+ raw = os .environ .get (name )
90+ if raw is not None :
91+ return raw
92+ try :
93+ sec = st .secrets .get (name )
94+ except (AttributeError , FileNotFoundError , OSError , RuntimeError ):
95+ sec = None
96+ if sec is None :
97+ return None
98+ return str (sec )
99+
100+
87101def _on_streamlit_cloud () -> bool :
88102 # Streamlit Cloud exposes this in hosted apps.
89103 return _is_truthy (os .environ .get ("STREAMLIT_SHARING_MODE" ))
90104
91105
92106def _default_bool_env (name : str , cloud_default : bool , local_default : bool ) -> bool :
93- raw = os . environ . get (name )
107+ raw = _setting (name )
94108 if raw is not None :
95109 return _is_truthy (raw )
96110 return cloud_default if _on_streamlit_cloud () else local_default
@@ -115,7 +129,7 @@ def _bootstrap_resale_if_missing(default_path: str) -> str:
115129 local_default = False ,
116130 )
117131 if auto_fetch :
118- max_rows_raw = os . environ . get ("SINGAPORE_EDA_BOOTSTRAP_MAX_ROWS" , "20000" )
132+ max_rows_raw = _setting ("SINGAPORE_EDA_BOOTSTRAP_MAX_ROWS" ) or "20000"
119133 try :
120134 max_rows = max (1000 , int (str (max_rows_raw ).strip ()))
121135 except ValueError :
You can’t perform that action at this time.
0 commit comments