Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
742393c25b
|
||
|
|
e9cb1f6c45
|
||
|
|
37d08d54fa
|
||
|
|
08e50b132f
|
+1
-1
@@ -1,4 +1,4 @@
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Config {
|
||||
pub url: String,
|
||||
pub bucket: String,
|
||||
|
||||
+9
-2
@@ -2,7 +2,7 @@ pub mod config;
|
||||
|
||||
use aws_sdk_s3::config::{Credentials, Region};
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Data {
|
||||
pub filepath: String,
|
||||
pub raw_data: Vec<u8>,
|
||||
@@ -16,6 +16,7 @@ pub async fn load_data(filepath: &str) -> Result<Vec<u8>, std::io::Error> {
|
||||
tokio::fs::read(filepath).await
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Info(String),
|
||||
SError(aws_sdk_s3::operation::put_object::PutObjectError),
|
||||
@@ -41,11 +42,17 @@ impl Labyrinth {
|
||||
let config = aws_config::from_env()
|
||||
.region(region)
|
||||
.credentials_provider(credentials)
|
||||
.endpoint_url(self.config.url.clone())
|
||||
.load()
|
||||
.await;
|
||||
|
||||
let s3_config = aws_sdk_s3::config::Builder::from(&config)
|
||||
.force_path_style(true) // 👈 CRITICAL for Garage/MinIO/LocalStack
|
||||
.build();
|
||||
|
||||
// let config = aws_config::load_from_env().await;
|
||||
let client = aws_sdk_s3::Client::new(&config);
|
||||
// let client = aws_sdk_s3::Client::new(&config);
|
||||
let client = aws_sdk_s3::Client::from_conf(s3_config);
|
||||
|
||||
let data_content = if data.raw_data.is_empty() {
|
||||
match load_data(&data.filepath).await {
|
||||
|
||||
Reference in New Issue
Block a user