feat(storage): resolve portable workspace roots
This commit is contained in:
@@ -254,6 +254,26 @@ def load_config(path: Path) -> Config:
|
||||
raise ConfigError(
|
||||
f"transport: rest richiede la sezione `rest` (base_url, api_key) in {path}."
|
||||
)
|
||||
data_root = os.environ.get("THT_DATA_ROOT")
|
||||
if data_root:
|
||||
# Import locally: paths owns resolution, while ConfigError remains the public
|
||||
# configuration exception callers already handle.
|
||||
from tht.paths import resolve_workspace_paths
|
||||
|
||||
resolved = resolve_workspace_paths(path, cfg, Path(data_root))
|
||||
cfg = cfg.model_copy(
|
||||
update={
|
||||
"paths": PathsConfig(
|
||||
sessions=resolved.sessions,
|
||||
artifacts=resolved.artifacts,
|
||||
indexes=resolved.indexes,
|
||||
)
|
||||
}
|
||||
)
|
||||
elif not used_legacy:
|
||||
# Modern `roots` replace `paths`; without a mounted data root retain the old
|
||||
# working-directory-relative behavior used by local development.
|
||||
cfg = cfg.model_copy(update={"paths": PathsConfig(**cfg.roots.model_dump())})
|
||||
if used_legacy:
|
||||
warnings.warn(
|
||||
"DEPRECATION: legacy workspace resource keys are deprecated; "
|
||||
|
||||
Reference in New Issue
Block a user