use std::path::PathBuf;
use crate::graph::GraphNodeReference;
use super::{
path::{FromPackage, Path},
Group, User,
{apt::AptPackage, systemd::SystemdService},
};
pub struct Nginx {
service: SystemdService,
node: GraphNodeReference,
}
impl AptPackage for Nginx {
const NAME: &'static str = "nginx";
fn create(node: GraphNodeReference) -> Self {
Nginx {
service: SystemdService::from_name_unchecked("nginx", node, vec![node]),
node,
}
}
fn graph_node(&self) -> GraphNodeReference {
self.node
}
}
impl Nginx {
pub fn binary(&self) -> Path<FromPackage> {
Path {
base: PathBuf::from("/usr/sbin/nginx"),
path: PathBuf::new(),
loc: FromPackage,
node: Some(self.graph_node()),
}
}
pub fn default_service(&mut self) -> &mut SystemdService {
&mut self.service
}
pub fn www_data_user(&self) -> User {
User {
uid: None,
name: "www-data".to_owned(),
node: self.graph_node(),
}
}
pub fn www_data_group(&self) -> Group {
Group {
gid: None,
name: "www-data".to_owned(),
node: self.graph_node(),
}
}
}