diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-12 13:30:19 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-12 13:30:19 +0000 |
| commit | af3f5430a0b0f1834228b28fd89848959512e718 (patch) | |
| tree | 27e843c147b92bf09893012f323ddaf54f5eb0a5 /src/files.rs | |
| parent | 385102a5763f667d53a9d8ed2052ccb8c791bc91 (diff) | |
Use configuration for environment variables
Diffstat (limited to 'src/files.rs')
| -rw-r--r-- | src/files.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/files.rs b/src/files.rs index 616a75d..73e0497 100644 --- a/src/files.rs +++ b/src/files.rs @@ -1,4 +1,4 @@ -use crate::config::{SAVE_FILE_BASE_PATH, UPLOADS_ENDPOINT}; +use crate::config::CONFIG; use crate::errors::AppError; use axum::{ extract::{Multipart, Path}, @@ -30,8 +30,8 @@ pub async fn upload( { let rnd = (random::<f32>() * 1000000000 as f32) as i32; - let save_filename = format!("{}/{}.{}", SAVE_FILE_BASE_PATH, rnd, ext_name); - uploaded_file = format!("{}/{}.{}", UPLOADS_ENDPOINT, rnd, ext_name); + let save_filename = format!("{}/{}.{}", CONFIG.save_file_base_path, rnd, ext_name); + uploaded_file = format!("{}/{}.{}", CONFIG.uploads_endpoint, rnd, ext_name); let data = file.bytes().await.unwrap(); @@ -70,6 +70,6 @@ pub async fn show_uploads(Path(id): Path<String>) -> (HeaderMap, Vec<u8>) { HeaderValue::from_str(&content_type).unwrap(), ); } - let file_name = format!("{}/{}", SAVE_FILE_BASE_PATH, id); + let file_name = format!("{}/{}", CONFIG.save_file_base_path, id); (headers, read(&file_name).unwrap()) } |
