@@ -99,8 +99,12 @@ impl ObjectStoreBuilder {
99
99
}
100
100
}
101
101
102
- pub fn with_options ( mut self , options : HashMap < String , String > ) -> Self {
103
- self . options = options;
102
+ pub fn with_options < I : IntoIterator < Item = ( impl Into < String > , impl Into < String > ) > > (
103
+ mut self ,
104
+ options : I ,
105
+ ) -> Self {
106
+ self . options
107
+ . extend ( options. into_iter ( ) . map ( |( k, v) | ( k. into ( ) , v. into ( ) ) ) ) ;
104
108
self
105
109
}
106
110
@@ -158,7 +162,7 @@ impl ObjectStoreBuilder {
158
162
ObjectStoreKind :: Azure => {
159
163
let maybe_store = MicrosoftAzureBuilder :: new ( )
160
164
. with_url ( url. clone ( ) )
161
- . with_options ( & self . options )
165
+ . try_with_options ( & self . options ) ?
162
166
. with_client_options ( self . client_options . clone ( ) . unwrap_or_default ( ) )
163
167
. with_retry ( self . retry_config . clone ( ) . unwrap_or_default ( ) )
164
168
. build ( ) ;
@@ -167,7 +171,7 @@ impl ObjectStoreBuilder {
167
171
} else {
168
172
let store = MicrosoftAzureBuilder :: from_env ( )
169
173
. with_url ( url. clone ( ) )
170
- . with_options ( & self . options )
174
+ . try_with_options ( & self . options ) ?
171
175
. with_client_options ( self . client_options . unwrap_or_default ( ) )
172
176
. with_retry ( self . retry_config . unwrap_or_default ( ) )
173
177
. build ( ) ?;
@@ -177,7 +181,7 @@ impl ObjectStoreBuilder {
177
181
ObjectStoreKind :: S3 => {
178
182
let maybe_store = AmazonS3Builder :: new ( )
179
183
. with_url ( url. clone ( ) )
180
- . with_options ( & self . options )
184
+ . try_with_options ( & self . options ) ?
181
185
. with_client_options ( self . client_options . clone ( ) . unwrap_or_default ( ) )
182
186
. with_retry ( self . retry_config . clone ( ) . unwrap_or_default ( ) )
183
187
. build ( ) ;
@@ -186,7 +190,7 @@ impl ObjectStoreBuilder {
186
190
} else {
187
191
let store = AmazonS3Builder :: from_env ( )
188
192
. with_url ( url. clone ( ) )
189
- . with_options ( & self . options )
193
+ . try_with_options ( & self . options ) ?
190
194
. with_client_options ( self . client_options . unwrap_or_default ( ) )
191
195
. with_retry ( self . retry_config . unwrap_or_default ( ) )
192
196
. build ( ) ?;
@@ -196,7 +200,7 @@ impl ObjectStoreBuilder {
196
200
ObjectStoreKind :: Google => {
197
201
let maybe_store = GoogleCloudStorageBuilder :: new ( )
198
202
. with_url ( url. clone ( ) )
199
- . with_options ( & self . options )
203
+ . try_with_options ( & self . options ) ?
200
204
. with_client_options ( self . client_options . clone ( ) . unwrap_or_default ( ) )
201
205
. with_retry ( self . retry_config . clone ( ) . unwrap_or_default ( ) )
202
206
. build ( ) ;
@@ -205,7 +209,7 @@ impl ObjectStoreBuilder {
205
209
} else {
206
210
let store = GoogleCloudStorageBuilder :: from_env ( )
207
211
. with_url ( url. clone ( ) )
208
- . with_options ( & self . options )
212
+ . try_with_options ( & self . options ) ?
209
213
. with_client_options ( self . client_options . unwrap_or_default ( ) )
210
214
. with_retry ( self . retry_config . unwrap_or_default ( ) )
211
215
. build ( ) ?;
0 commit comments