Spaces:
Sleeping
Sleeping
Monteeq CI commited on
Commit Β·
a010e8e
1
Parent(s): a468b11
π Deploy from GitHub @ 77b253d514d91e93ec286153badba977a74696a0
Browse filesTriggered by: Smasduq
Message: feat: update admin dashboard dependencies, enhance login flow, and improve API interactions
- Added new dependencies: @hookform/resolvers, framer-motion, react-hook-form, react-is, and zod.
- Updated @vitejs /plugin-react and vite versions in devDependencies.
- Refactored login function to handle token retrieval and user role validation more robustly.
- Introduced new API functions for managing videos and reports.
- Updated README with relevant scripts and development notes.
- Enhanced CORS handling in backend middleware for improved security and flexibility.
- README.md +8 -7
- src/storage.rs +12 -9
README.md
CHANGED
|
@@ -16,14 +16,15 @@ High-performance, asynchronous Rust service for processing and transcoding video
|
|
| 16 |
|
| 17 |
## Configuration
|
| 18 |
|
| 19 |
-
In your Hugging Face Space settings, add the following **Secrets**:
|
| 20 |
|
| 21 |
| Secret Name | Value |
|
| 22 |
|---|---|
|
| 23 |
| `REDIS_URL` | Redis Cloud connection URL |
|
| 24 |
-
| `
|
| 25 |
-
| `
|
| 26 |
-
| `
|
| 27 |
-
| `
|
| 28 |
-
| `
|
| 29 |
-
|
|
|
|
|
|
| 16 |
|
| 17 |
## Configuration
|
| 18 |
|
| 19 |
+
In your Hugging Face Space settings, add the following **Secrets** (AWS S3 β match `backend/.env`):
|
| 20 |
|
| 21 |
| Secret Name | Value |
|
| 22 |
|---|---|
|
| 23 |
| `REDIS_URL` | Redis Cloud connection URL |
|
| 24 |
+
| `AWS_ACCESS_KEY_ID` | AWS access key |
|
| 25 |
+
| `AWS_SECRET_ACCESS_KEY` | AWS secret key |
|
| 26 |
+
| `AWS_STORAGE_BUCKET_NAME` | `monteeq-2` |
|
| 27 |
+
| `AWS_S3_REGION_NAME` | `eu-central-1` |
|
| 28 |
+
| `AWS_CLOUDFRONT_DOMAIN` | `cdn.monteeq.com` |
|
| 29 |
+
|
| 30 |
+
Leave `S3_ENDPOINT` unset (or empty) so the service uses native AWS S3.
|
src/storage.rs
CHANGED
|
@@ -29,13 +29,16 @@ impl StorageManager {
|
|
| 29 |
|
| 30 |
let mut s3_config_builder = aws_sdk_s3::config::Builder::from(&config);
|
| 31 |
|
| 32 |
-
//
|
| 33 |
if let Ok(endpoint) = std::env::var("S3_ENDPOINT") {
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
}
|
| 41 |
|
|
@@ -52,9 +55,9 @@ impl StorageManager {
|
|
| 52 |
let s3_config = s3_config_builder.build();
|
| 53 |
let client = Client::from_conf(s3_config);
|
| 54 |
|
| 55 |
-
let bucket = std::env::var("
|
| 56 |
-
.or_else(|_| std::env::var("
|
| 57 |
-
.map_err(|_| anyhow!("Storage bucket name not set (
|
| 58 |
|
| 59 |
Ok(Self { client, bucket })
|
| 60 |
}
|
|
|
|
| 29 |
|
| 30 |
let mut s3_config_builder = aws_sdk_s3::config::Builder::from(&config);
|
| 31 |
|
| 32 |
+
// Custom endpoint only when non-empty (empty S3_ENDPOINT β native AWS)
|
| 33 |
if let Ok(endpoint) = std::env::var("S3_ENDPOINT") {
|
| 34 |
+
let endpoint = endpoint.trim().to_string();
|
| 35 |
+
if !endpoint.is_empty() {
|
| 36 |
+
println!("Rust: Using custom S3 endpoint: {}", endpoint);
|
| 37 |
+
s3_config_builder = s3_config_builder.endpoint_url(endpoint.clone());
|
| 38 |
+
if !endpoint.contains("amazonaws.com") {
|
| 39 |
+
println!("Rust: Enabling force_path_style for custom endpoint");
|
| 40 |
+
s3_config_builder = s3_config_builder.force_path_style(true);
|
| 41 |
+
}
|
| 42 |
}
|
| 43 |
}
|
| 44 |
|
|
|
|
| 55 |
let s3_config = s3_config_builder.build();
|
| 56 |
let client = Client::from_conf(s3_config);
|
| 57 |
|
| 58 |
+
let bucket = std::env::var("AWS_STORAGE_BUCKET_NAME")
|
| 59 |
+
.or_else(|_| std::env::var("S3_BUCKET_NAME"))
|
| 60 |
+
.map_err(|_| anyhow!("Storage bucket name not set (AWS_STORAGE_BUCKET_NAME or S3_BUCKET_NAME)"))?;
|
| 61 |
|
| 62 |
Ok(Self { client, bucket })
|
| 63 |
}
|