Update rust-s3 dependency and move Cargo.toml dependencies

This commit is contained in:
Alex Auvolat
2023-05-12 12:12:32 +02:00
parent 30a3cec87e
commit 10e06737cf
6 changed files with 120 additions and 110 deletions
+3 -1
View File
@@ -18,7 +18,8 @@ rocket_i18n = "0.4.1"
reqwest = "0.11.11"
scheduled-thread-pool = "0.2.6"
serde = "1.0.137"
rust-s3 = { version = "0.29.0", no-default-features = true, features = ["blocking"] }
#rust-s3 = { version = "0.29.0", default-features = false, features = ["blocking"] }
rust-s3 = { version = "0.33.0", optional = true, features = ["blocking"] }
serde_derive = "1.0"
serde_json = "1.0.81"
tantivy = "0.13.3"
@@ -62,3 +63,4 @@ diesel_migrations = "1.3.0"
postgres = ["diesel/postgres", "plume-macro/postgres" ]
sqlite = ["diesel/sqlite", "plume-macro/sqlite" ]
search-lindera = ["lindera-tantivy"]
s3 = ["rust-s3"]
+5 -3
View File
@@ -392,13 +392,15 @@ impl S3Config {
secret_key: Some(self.access_key_secret.clone()),
security_token: None,
session_token: None,
expiration: None,
};
let bucket = Bucket::new(&self.bucket, region, credentials).unwrap();
if self.path_style {
Bucket::new_with_path_style(&self.bucket, region, credentials)
bucket.with_path_style()
} else {
Bucket::new(&self.bucket, region, credentials)
}.unwrap()
bucket
}
}
}
+6 -4
View File
@@ -69,7 +69,8 @@ pub enum Error {
Webfinger,
Expired,
UserAlreadyExists,
Anyhow(anyhow::Error),
#[cfg(feature = "s3")]
S3(s3::error::S3Error),
}
impl From<bcrypt::BcryptError> for Error {
@@ -171,9 +172,10 @@ impl From<request::Error> for Error {
}
}
impl From<anyhow::Error> for Error {
fn from(err: anyhow::Error) -> Error {
Error::Anyhow(err)
#[cfg(feature = "s3")]
impl From<s3::error::S3Error> for Error {
fn from(err: s3::error::S3Error) -> Error {
Error::S3(err)
}
}