@@ -97,6 +97,7 @@ async def lifespan(app: FastAPI):
9797
9898 # Do the following at API Startup:
9999 print_launch_message ()
100+ _print_storage_banner ()
100101 # Initialize directories early
101102 from transformerlab .shared import dirs as shared_dirs
102103
@@ -362,6 +363,13 @@ async def healthz():
362363 "metadata" : {
363364 "email_method" : email_method ,
364365 },
366+ # Only the provider is exposed here — /healthz is unauthenticated, so
367+ # the bucket/path URI must NOT leak. The full URI is logged at startup
368+ # (operator-visible) and can be added to authenticated endpoints if
369+ # the CLI/UI ever needs it.
370+ "storage" : {
371+ "provider" : _effective_storage_provider (),
372+ },
365373 }
366374
367375
@@ -410,6 +418,46 @@ def print_launch_message():
410418 print ("https://lab.cloud\n https://github.com/transformerlab/transformerlab-app\n " )
411419
412420
421+ def _effective_storage_provider () -> str :
422+ """Return the storage backend that's actually in use.
423+
424+ `TFL_STORAGE_PROVIDER` alone isn't authoritative: when it's set to
425+ aws/gcp/azure but `TFL_REMOTE_STORAGE_ENABLED` isn't `true`, the SDK
426+ silently falls back to the local filesystem at `~/.transformerlab`.
427+ Reporting the configured provider in that case is misleading, so callers
428+ should use this helper instead.
429+ """
430+ from lab .storage import STORAGE_PROVIDER
431+
432+ if STORAGE_PROVIDER == "localfs" :
433+ return "localfs"
434+ remote_enabled = os .getenv ("TFL_REMOTE_STORAGE_ENABLED" , "false" ).lower () == "true"
435+ return STORAGE_PROVIDER if remote_enabled else "localfs"
436+
437+
438+ def _print_storage_banner ():
439+ """Print the active storage backend so it's obvious in API logs."""
440+ from lab .storage import STORAGE_PROVIDER
441+
442+ effective = _effective_storage_provider ()
443+ uri = os .getenv ("TFL_STORAGE_URI" )
444+ if effective == "localfs" :
445+ # Either configured as localfs, or remote was requested but not enabled —
446+ # in both cases the SDK uses ~/.transformerlab/workspace.
447+ from lab .dirs import HOME_DIR
448+
449+ if not uri :
450+ uri = os .path .join (HOME_DIR , "orgs" , "<org_id>" , "workspace" )
451+ if effective != STORAGE_PROVIDER :
452+ # Surface the misconfiguration so operators don't think remote is live.
453+ print (
454+ f"✅ Storage: { effective } ({ uri } ) "
455+ f"[TFL_STORAGE_PROVIDER={ STORAGE_PROVIDER } ignored: TFL_REMOTE_STORAGE_ENABLED is not set]"
456+ )
457+ return
458+ print (f"✅ Storage: { effective } ({ uri or 'unset' } )" )
459+
460+
413461def run ():
414462 args = parse_args ()
415463
0 commit comments