@@ -8,6 +8,25 @@ use std::path::Path;
8
8
9
9
static TOKENS_PATH : & ' static str = "tokens.toml" ;
10
10
11
+ #[ derive( Debug , Clone , Deserialize ) ]
12
+ #[ serde( tag = "type" , rename_all = "kebab-case" ) ]
13
+ pub enum BucketRegion {
14
+ S3 { region : String } ,
15
+ Custom { url : String } ,
16
+ }
17
+
18
+ impl BucketRegion {
19
+ pub fn to_region ( & self ) -> Result < Region > {
20
+ match * self {
21
+ BucketRegion :: S3 { ref region } => Ok ( region. parse ( ) ?) ,
22
+ BucketRegion :: Custom { ref url } => Ok ( Region :: Custom {
23
+ name : "custom" . to_string ( ) ,
24
+ endpoint : url. clone ( ) ,
25
+ } ) ,
26
+ }
27
+ }
28
+ }
29
+
11
30
#[ derive( Debug , Clone , Deserialize ) ]
12
31
#[ serde( rename_all = "kebab-case" ) ]
13
32
pub struct BotTokens {
@@ -18,7 +37,7 @@ pub struct BotTokens {
18
37
#[ derive( Debug , Clone , Deserialize ) ]
19
38
#[ serde( rename_all = "kebab-case" ) ]
20
39
pub struct ReportsBucket {
21
- pub region : Region ,
40
+ pub region : BucketRegion ,
22
41
pub bucket : String ,
23
42
pub public_url : String ,
24
43
pub access_key : String ,
@@ -57,7 +76,9 @@ impl Default for Tokens {
57
76
api_token : String :: new ( ) ,
58
77
} ,
59
78
reports_bucket : ReportsBucket {
60
- region : "us-east-1" . parse ( ) . unwrap ( ) ,
79
+ region : BucketRegion :: S3 {
80
+ region : "us-west-1" . to_string ( ) ,
81
+ } ,
61
82
bucket : "crater-reports" . into ( ) ,
62
83
public_url : String :: new ( ) ,
63
84
access_key : String :: new ( ) ,
0 commit comments