diff --git a/backend/storage/src/services/aws.rs b/backend/storage/src/services/aws.rs index aae82d0..237b088 100644 --- a/backend/storage/src/services/aws.rs +++ b/backend/storage/src/services/aws.rs @@ -18,6 +18,22 @@ pub struct S3Client { } impl S3ClientConfig { + pub fn new( + access_key: &str, + secret_key: &str, + endpoint: &str, + bucket: &str, + region: &str, + ) -> Result> { + Ok(S3ClientConfig { + access_key: access_key.to_owned(), + secret_key: secret_key.to_owned(), + endpoint: endpoint.to_owned(), + bucket: bucket.to_owned(), + region: region.to_owned(), + }) + } + pub fn from_env() -> Result> { Ok(S3ClientConfig { access_key: env::var("S3_ACCESS_KEY") @@ -99,3 +115,9 @@ impl ObjectStorageClient for S3Client { todo!("not impl") } } + +impl Default for S3ClientConfig { + fn default() -> Self { + S3ClientConfig::from_env().unwrap() + } +}