cloud: fix missing region config for aws
@@ -104,7 +104,7 @@ impl Config {
bucket: StringNonEmpty::required_field(input.bucket, "bucket")?,
prefix: StringNonEmpty::opt(input.prefix),
storage_class: storage_class.clone(),
- region: None,
+ region: StringNonEmpty::opt(input.region),
};
let access_key_pair = match StringNonEmpty::opt(input.access_key) {
None => None,
@@ -691,10 +691,16 @@ mod tests {
let mut input = InputConfig::default();
input.set_bucket("bucket".to_owned());
input.set_prefix("backup 02/prefix/".to_owned());
+ input.set_region("us-west-2".to_owned());
let c1 = Config::from_input(input.clone()).unwrap();
let c2 = Config::from_cloud_dynamic(&cloud_dynamic_from_input(input)).unwrap();
assert_eq!(c1.bucket.bucket, c2.bucket.bucket);
assert_eq!(c1.bucket.prefix, c2.bucket.prefix);
+ assert_eq!(c1.bucket.region, c2.bucket.region);
+ assert_eq!(
+ c1.bucket.region,
+ StringNonEmpty::opt("us-west-2".to_owned())
+ );
}
fn cloud_dynamic_from_input(mut s3: InputConfig) -> CloudDynamic {
