Skip to content

Commit f01cc57

Browse files
committed
[sia] add bucket support
1 parent ce64f3b commit f01cc57

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/store/create.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Map<String, ObjectStore> createStoresFromConfig(
104104
: siaConfig['busApiUrl'],
105105
apiPassword: siaConfig['apiPassword']!,
106106
downloadUrls: [siaConfig['downloadUrl']!],
107+
bucket: siaConfig['bucket'] ?? 'default',
107108
httpClient: httpClient,
108109
);
109110
}

lib/store/sia.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class SiaObjectStore extends ObjectStore {
1414
final String busApiUrl;
1515
final String workerApiUrl;
1616
final String apiPassword;
17+
final String bucket;
1718
final Client httpClient;
1819

1920
final List<String> downloadUrls;
@@ -24,7 +25,9 @@ class SiaObjectStore extends ObjectStore {
2425
final availableBaoOutboardHashes = <Multihash>{};
2526

2627
Uri _getApiUri(String path) {
27-
return Uri.parse('$workerApiUrl$path');
28+
return Uri.parse('$workerApiUrl$path').replace(queryParameters: {
29+
'bucket': bucket,
30+
});
2831
}
2932

3033
@override
@@ -62,6 +65,7 @@ class SiaObjectStore extends ObjectStore {
6265
required this.apiPassword,
6366
required this.httpClient,
6467
required this.downloadUrls,
68+
required this.bucket,
6569
}) {
6670
_headers = {
6771
'Authorization': 'Basic ${base64Url.encode(utf8.encode(':$apiPassword'))}'

0 commit comments

Comments
 (0)