From af3f5430a0b0f1834228b28fd89848959512e718 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 12 Sep 2022 15:30:19 +0200 Subject: Use configuration for environment variables --- src/files.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/files.rs') 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::() * 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) -> (HeaderMap, Vec) { 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()) } -- cgit v1.2.3-71-g8e6c