aboutsummaryrefslogtreecommitdiff
path: root/src/login/mod.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2023-07-25 21:23:56 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2023-07-25 21:23:56 +0200
commit0450570f7682ee2735f53619681abd6a9ccff912 (patch)
tree5c8a448d4b86f294496a74978f5ee88a804d7ca1 /src/login/mod.rs
parent62b5cf070cf611b7f5d44a9e55befad121e5c603 (diff)
downloadaerogramme-0450570f7682ee2735f53619681abd6a9ccff912.tar.gz
aerogramme-0450570f7682ee2735f53619681abd6a9ccff912.zip
finalize for release 0.1.0
Diffstat (limited to 'src/login/mod.rs')
-rw-r--r--src/login/mod.rs37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/login/mod.rs b/src/login/mod.rs
index a68cd9c..a204db4 100644
--- a/src/login/mod.rs
+++ b/src/login/mod.rs
@@ -7,11 +7,11 @@ use std::sync::Arc;
use anyhow::{anyhow, bail, Context, Result};
use async_trait::async_trait;
use k2v_client::{
- BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue, K2vClientConfig
+ BatchInsertOp, BatchReadOp, CausalValue, CausalityToken, Filter, K2vClient, K2vValue
};
use rand::prelude::*;
use rusoto_core::HttpClient;
-use rusoto_credential::{StaticProvider};
+use rusoto_credential::{AwsCredentials, StaticProvider};
use rusoto_s3::S3Client;
use crate::cryptoblob::*;
@@ -120,16 +120,19 @@ impl Credentials {
impl StorageCredentials {
pub fn k2v_client(&self) -> Result<K2vClient> {
- let config = K2vClientConfig {
- endpoint: self.k2v_region.endpoint.clone(),
- region: self.k2v_region.name.clone(),
- aws_access_key_id: self.aws_access_key_id.clone(),
- aws_secret_access_key: self.aws_secret_access_key.clone(),
- bucket: self.bucket.clone(),
- user_agent: None,
- };
-
- Ok(K2vClient::new(config)?)
+ let aws_creds = AwsCredentials::new(
+ self.aws_access_key_id.clone(),
+ self.aws_secret_access_key.clone(),
+ None,
+ None,
+ );
+
+ Ok(K2vClient::new(
+ self.k2v_region.as_rusoto_region(),
+ self.bucket.clone(),
+ aws_creds,
+ None,
+ )?)
}
pub fn s3_client(&self) -> Result<S3Client> {
@@ -138,8 +141,16 @@ impl StorageCredentials {
self.aws_secret_access_key.clone(),
);
+ let connector = hyper_rustls::HttpsConnectorBuilder::new()
+ .with_native_roots()
+ .https_or_http()
+ .enable_http1()
+ .enable_http2()
+ .build();
+ let client = HttpClient::from_connector(connector);
+
Ok(S3Client::new_with(
- HttpClient::new()?,
+ client,
aws_creds_provider,
self.s3_region.as_rusoto_region(),
))