Author: Jason White [github@jasonwhite.io]
Hash: 25513c4bda52f3711674b7b75128a4ad5b22a141
Timestamp: Fri, 13 Mar 2020 16:16:13 +0000 (4 years ago)

+10 -1 +/-2 browse
Log warning when AWS_S3_ENDPOINT is set without a region
1diff --git a/rustfmt.toml b/rustfmt.toml
2index 2451809..8118c57 100644
3--- a/rustfmt.toml
4+++ b/rustfmt.toml
5 @@ -1,4 +1,5 @@
6 max_width = 80
7+ format_strings = true
8 error_on_line_overflow = true
9 error_on_unformatted = true
10 normalize_comments = true
11 diff --git a/src/storage/s3.rs b/src/storage/s3.rs
12index 60d3b00..b28bac6 100644
13--- a/src/storage/s3.rs
14+++ b/src/storage/s3.rs
15 @@ -111,7 +111,15 @@ impl Backend {
16 Region::Custom {
17 name: std::env::var("AWS_DEFAULT_REGION")
18 .or_else(|_| std::env::var("AWS_REGION"))
19- .unwrap(),
20+ .unwrap_or_else(|_| {
21+ log::warn!(
22+ "AWS_S3_ENDPOINT was set without \
23+ AWS_DEFAULT_REGION or AWS_REGION being set. \
24+ Defaulting to 'us-east-1', which probably \
25+ doesn't make sense with a custom endpoint."
26+ );
27+ String::from("us-east-1")
28+ }),
29 endpoint,
30 }
31 } else {