Sites are now explicitely defined
This fixes the issue where deploying the default site would delete all other sites, because they're subdirs of the default dir.
This commit is contained in:
parent
143f892c52
commit
6505e02dd4
4 changed files with 46 additions and 17 deletions
|
|
@ -11,7 +11,7 @@ use serde::Deserialize;
|
|||
use tar::Archive;
|
||||
use tokio_util::io::StreamReader;
|
||||
|
||||
use crate::DEFAULT_STATIC_DIR_NAME;
|
||||
use crate::{DEFAULT_STATIC_SITE, STATIC_DIR_NAME};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct StaticDirParams
|
||||
|
|
@ -34,11 +34,10 @@ pub async fn post_deploy(
|
|||
let mut file = tokio::fs::File::create(&file_path).await.unwrap();
|
||||
tokio::io::copy(&mut read, &mut file).await;
|
||||
|
||||
let mut static_path = Path::new(&data_dir).join(DEFAULT_STATIC_DIR_NAME);
|
||||
|
||||
if params.dir.is_some() {
|
||||
static_path = static_path.join(params.dir.unwrap());
|
||||
}
|
||||
// If no dir is provided, we use the default one. Otherwise, use the provided one.
|
||||
let static_path = Path::new(&data_dir)
|
||||
.join(STATIC_DIR_NAME)
|
||||
.join(params.dir.unwrap_or(DEFAULT_STATIC_SITE.to_string()));
|
||||
|
||||
// Make sure the static directory exists
|
||||
tokio::fs::create_dir_all(&static_path).await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue