Skip to content

Commit 97e31b7

Browse files
committed
refactor: fix variable names in MinIO support
1 parent b887de2 commit 97e31b7

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/datasets.jl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,15 @@ function _write_rclone_config(
868868
access_key_id::AbstractString,
869869
secret_access_key::AbstractString,
870870
session_token::AbstractString,
871-
provider::AbstractString="AWS",
872-
endpoint::AbstractString="",
871+
vendor::AbstractString,
872+
endpoint::AbstractString,
873873
)
874-
if lowercase(provider) == "aws"
875-
provider = "AWS"
876-
elseif lowercase(provider) == "minio"
877-
provider = "Minio"
874+
provider = if vendor == "aws"
875+
"AWS"
876+
elseif vendor == "minio"
877+
"Minio"
878878
else
879-
throw(JuliaHubError("Unknown storage backend $(provider)"))
879+
throw(JuliaHubError("Unknown storage backend $(vendor)"))
880880
end
881881

882882
write(
@@ -904,10 +904,10 @@ function _write_rclone_config(io::IO, upload_config::Dict)
904904
access_key_id = upload_config["credentials"]["access_key_id"]
905905
secret_access_key = upload_config["credentials"]["secret_access_key"]
906906
session_token = upload_config["credentials"]["session_token"]
907-
provider = upload_config["vendor"]
907+
vendor = upload_config["vendor"]
908908
endpoint = get(upload_config["credentials"], "endpoint_url", "")
909909
_write_rclone_config(
910-
io; region, access_key_id, secret_access_key, session_token, provider, endpoint
910+
io; region, access_key_id, secret_access_key, session_token, vendor, endpoint
911911
)
912912
end
913913

@@ -1002,9 +1002,10 @@ function download_dataset(
10021002
throw(InvalidRequestError("Dataset '$(dataset.name)' does not have version 'v$version'"))
10031003

10041004
credentials = Mocking.@mock _get_dataset_credentials(auth, dataset)
1005-
provider = credentials["vendor"]
1006-
provider in ("aws", "minio") ||
1007-
throw(JuliaHubError("Unknown 'vendor': $(credentials["vendor"])"))
1005+
vendor = credentials["vendor"]
1006+
if !(vendor in ("aws", "minio"))
1007+
throw(JuliaHubError("Unknown 'vendor': $(vendor)"))
1008+
end
10081009
credentials = credentials["credentials"]
10091010
endpoint = get(credentials, "endpoint_url", "")
10101011

@@ -1035,7 +1036,7 @@ function download_dataset(
10351036
access_key_id=credentials["access_key_id"],
10361037
secret_access_key=credentials["secret_access_key"],
10371038
session_token=credentials["session_token"],
1038-
provider=provider,
1039+
vendor=vendor,
10391040
endpoint=endpoint,
10401041
)
10411042
close(rclone_conf_io)

0 commit comments

Comments
 (0)