diff --git a/dvc_webhdfs/__init__.py b/dvc_webhdfs/__init__.py index dbcb237..f2ebd3a 100644 --- a/dvc_webhdfs/__init__.py +++ b/dvc_webhdfs/__init__.py @@ -42,6 +42,17 @@ def _prepare_credentials(self, **config): principal = config.pop("kerberos_principal", None) if principal: config["kerb_kwargs"] = {"principal": principal} + + # If target data_proxy provided construct the source from host/port + data_proxy_target = config.pop("data_proxy_target", None) + if data_proxy_target: + host = config["host"] + port = config["port"] + + protocol = "https" if config.get("use_https") else "http" + + source_url = f"{protocol}://{host}:{port}/webhdfs/v1" + config["data_proxy"] = {source_url: data_proxy_target} return config @wrap_prop(threading.Lock())