@@ -196,6 +196,11 @@ def _get_secret_or_env(key: str, default: str = None) -> str:
196196 else :
197197 raise
198198
199+ # When true, skip StorageOrganizer .gitkeep seeding on app startup (no PUTs to remote).
200+ STORAGE_SKIP_DIRECTORY_BOOTSTRAP = _get_secret_or_env (
201+ "STORAGE_SKIP_DIRECTORY_BOOTSTRAP" , "false"
202+ ).lower () in ("true" , "1" , "t" )
203+
199204# Cache Configuration
200205CACHE_ENABLED = _get_secret_or_env ("CACHE_ENABLED" , "true" ).lower () in (
201206 "true" ,
@@ -241,3 +246,34 @@ def _get_secret_or_env(key: str, default: str = None) -> str:
241246 f"MAX_DEPTH ({ MAX_DEPTH } ) is outside recommended range (0-10). "
242247 "Consider using a value between 1-5 for optimal performance."
243248 )
249+
250+ # NLP veto (second opinion on fuzzy direct + heuristic hits)
251+ MATCHING_NLP_VETO_ENABLED = _get_secret_or_env (
252+ "MATCHING_NLP_VETO_ENABLED" , "false"
253+ ).lower () in ("true" , "1" , "t" )
254+ MATCHING_NLP_VETO_THRESHOLD = float (
255+ _get_secret_or_env ("MATCHING_NLP_VETO_THRESHOLD" , "0.2" )
256+ )
257+ if not 0.0 <= MATCHING_NLP_VETO_THRESHOLD <= 1.0 :
258+ logger .warning (
259+ f"MATCHING_NLP_VETO_THRESHOLD ({ MATCHING_NLP_VETO_THRESHOLD } ) should be in [0, 1]; "
260+ "clamping may occur at runtime."
261+ )
262+
263+ # When set, match requests with no inline `okw_facilities` load `*.json` from this path
264+ # (recursively) instead of listing remote storage — avoids hanging curls when cloud
265+ # storage is slow or misconfigured. Production should normally leave this unset.
266+ _match_local = _get_secret_or_env ("MATCHING_LOCAL_OKW_JSON_DIR" , "" ) or ""
267+ MATCHING_LOCAL_OKW_JSON_DIR = _match_local .strip () if _match_local .strip () else None
268+
269+ # When true (default), MatchingService.initialize() eagerly loads spaCy models for
270+ # each domain. When false, models load on first NLP use — avoids long stalls inside
271+ # FastAPI Depends(get_matching_service) on constrained or cold-start environments.
272+ MATCHING_PREINIT_NLP = _get_secret_or_env ("MATCHING_PREINIT_NLP" , "true" ).lower () in (
273+ "true" ,
274+ "1" ,
275+ "t" ,
276+ )
277+
278+ # Do not log MATCHING_* here: this module imports before main.setup_logging(), so
279+ # INFO lines would be dropped by the default root logger (WARNING). Log from lifespan.
0 commit comments