feat: add nginx reload and validation wrappers with sudo permissions
This commit is contained in:
@@ -2,6 +2,7 @@ use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tracing::info;
|
||||
|
||||
use crate::commands::run::to_file_name;
|
||||
|
||||
@@ -26,6 +27,7 @@ impl WriteConfigCommand {
|
||||
let path = self.nginx_config_dir.clone();
|
||||
// ensure main config dir exists
|
||||
tokio::fs::create_dir_all(&path).await?;
|
||||
info!("Writing config to {:?}", path.join(&filename));
|
||||
|
||||
// create YANPM subdir where fragment files live
|
||||
let yanpm_dir = path.join(INTERNAL_CONFIG_FOLDER_NAME);
|
||||
@@ -62,7 +64,7 @@ impl WriteConfigCommand {
|
||||
|
||||
// set explicit permissions (rw-r-----)
|
||||
tokio::fs::set_permissions(&final_path, std::fs::Permissions::from_mode(0o640)).await?;
|
||||
|
||||
info!("Config written and permissions set for {:?}", final_path);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user