From 2e25aee2553da1ff6ca0830d321ad53c4fc20ce7 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Tue, 5 Nov 2024 20:32:42 +0500 Subject: [PATCH] Automatically create uploads directory --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c4d753f..43a962f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use axum::{ }; use log::info; use sqlx::postgres::PgPoolOptions; -use std::sync::Arc; +use std::{fs, sync::Arc}; use tokio::signal; use tower_http::services::ServeDir; @@ -20,6 +20,9 @@ mod web; async fn main() { env_logger::init(); + let images_dir = CONFIG.uploads_dir.join("images"); + fs::create_dir_all(images_dir).unwrap(); + let pool = PgPoolOptions::new() .max_connections(CONFIG.database.max_connections) .connect(&CONFIG.database.url)