Adrian Heine 2 years ago
parent
commit
426b531e4c
  1. 8
      src/builder.rs
  2. 5
      src/locator.rs
  3. 23
      src/resources/mod.rs
  4. 5
      src/templates/php.rs

8
src/builder.rs

@ -33,7 +33,9 @@ use crate::symbols::wordpress::{
Plugin as WordpressPluginSymbol, Translation as WordpressTranslationSymbol,
};
use crate::templates::nginx;
use crate::templates::php::{fpm_pool_config as php_fpm_pool_config, FpmPoolConfig as PhpFpmPoolConfig};
use crate::templates::php::{
fpm_pool_config as php_fpm_pool_config, FpmPoolConfig as PhpFpmPoolConfig,
};
use crate::templates::systemd::{
nodejs_service as systemd_nodejs_service, socket_service as systemd_socket_service,
};
@ -250,7 +252,9 @@ impl<D: AsRef<str> + Clone + Display> ImplementationBuilder<ServeCustom<D>> for
}
}
impl<D: Clone + Display, P: AsRef<Path>, C: Clone + Into<PhpFpmPoolConfig>> ImplementationBuilder<ServePhp<D, P, C>> for DefaultBuilder {
impl<D: Clone + Display, P: AsRef<Path>, C: Clone + Into<PhpFpmPoolConfig>>
ImplementationBuilder<ServePhp<D, P, C>> for DefaultBuilder
{
type Prerequisites = (
PhpFpmPool<D>,
CertChain<D>,

5
src/locator.rs

@ -302,7 +302,10 @@ impl<D: AsRef<Path>, P, C, POLICY> ResourceLocator<ServePhp<D, P, C>> for Defaul
type Prerequisites = ();
fn locate(
resource: &ServePhp<D, P, C>,
) -> (<ServePhp<D, P, C> as Resource>::Artifact, Self::Prerequisites) {
) -> (
<ServePhp<D, P, C> as Resource>::Artifact,
Self::Prerequisites,
) {
(
PathArtifact::from(Path::new("/etc/nginx/sites-enabled/").join(&resource.0)),
(),

23
src/resources/mod.rs

@ -147,13 +147,7 @@ impl<D> Resource for ServeCustom<D> {
}
#[derive(Debug, Hash, PartialEq, Eq)]
pub struct ServePhp<D, P, C>(
pub D,
pub P,
pub &'static str,
pub String,
pub C,
);
pub struct ServePhp<D, P, C>(pub D, pub P, pub &'static str, pub String, pub C);
impl<D, P, C> Resource for ServePhp<D, P, C> {
type Artifact = PathArtifact;
}
@ -319,7 +313,18 @@ default_resources!(
WordpressTranslation: WordpressTranslation<PathBuf>,
);
pub fn serve_php<D, P: Into<PathBuf>, C: Into<FpmPoolConfig>>(domain: D, path: P, root_filename: &'static str, nginx_config: impl Into<String>, pool_config: C) -> ServePhp<D, PathBuf, FpmPoolConfig> {
pub fn serve_php<D, P: Into<PathBuf>, C: Into<FpmPoolConfig>>(
domain: D,
path: P,
root_filename: &'static str,
nginx_config: impl Into<String>,
pool_config: C,
) -> ServePhp<D, PathBuf, FpmPoolConfig> {
ServePhp(
domain, path.into(), root_filename, nginx_config.into(), pool_config.into())
domain,
path.into(),
root_filename,
nginx_config.into(),
pool_config.into(),
)
}

5
src/templates/php.rs

@ -27,7 +27,10 @@ impl From<usize> for FpmPoolConfig {
impl FpmPoolConfig {
pub fn new(max_children: usize, custom: impl Into<String>) -> Self {
Self { max_children, custom: Some(custom.into()) }
Self {
max_children,
custom: Some(custom.into()),
}
}
}

Loading…
Cancel
Save