|
@ -2,6 +2,7 @@ use crate::artifacts::{ |
|
|
DatabaseName as DatabaseNameArtifact, Path as PathArtifact, ServiceName as ServiceNameArtifact,
|
|
|
DatabaseName as DatabaseNameArtifact, Path as PathArtifact, ServiceName as ServiceNameArtifact,
|
|
|
UserName as UserNameArtifact,
|
|
|
UserName as UserNameArtifact,
|
|
|
};
|
|
|
};
|
|
|
|
|
|
use crate::templates::php::FpmPoolConfig;
|
|
|
use std::hash::Hash;
|
|
|
use std::hash::Hash;
|
|
|
use std::path::PathBuf;
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
@ -146,8 +147,14 @@ impl<D> Resource for ServeCustom<D> { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[derive(Debug, Hash, PartialEq, Eq)]
|
|
|
#[derive(Debug, Hash, PartialEq, Eq)]
|
|
|
pub struct ServePhp<D, P>(pub D, pub P, pub &'static str, pub String, pub usize);
|
|
|
|
|
|
impl<D, P> Resource for ServePhp<D, P> {
|
|
|
|
|
|
|
|
|
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;
|
|
|
type Artifact = PathArtifact;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -177,7 +184,7 @@ impl Resource for DefaultServer { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[derive(Debug, Hash, PartialEq, Eq)]
|
|
|
#[derive(Debug, Hash, PartialEq, Eq)]
|
|
|
pub struct PhpFpmPool<D>(pub D, pub usize);
|
|
|
|
|
|
|
|
|
pub struct PhpFpmPool<D>(pub D, pub FpmPoolConfig);
|
|
|
impl<D> Resource for PhpFpmPool<D> {
|
|
|
impl<D> Resource for PhpFpmPool<D> {
|
|
|
type Artifact = (
|
|
|
type Artifact = (
|
|
|
PathArtifact,
|
|
|
PathArtifact,
|
|
@ -275,6 +282,7 @@ macro_rules! default_resources { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Only one enum entry per resource type, otherwise the equality checks fail
|
|
|
default_resources!(
|
|
|
default_resources!(
|
|
|
AcmeAccountKey: AcmeAccountKey,
|
|
|
AcmeAccountKey: AcmeAccountKey,
|
|
|
AcmeChallengesDir: AcmeChallengesDir,
|
|
|
AcmeChallengesDir: AcmeChallengesDir,
|
|
@ -301,7 +309,7 @@ default_resources!( |
|
|
PhpFpmPool: PhpFpmPool<D>,
|
|
|
PhpFpmPool: PhpFpmPool<D>,
|
|
|
ServeCustom: ServeCustom<D>,
|
|
|
ServeCustom: ServeCustom<D>,
|
|
|
ServeService: ServeService<D, PathBuf>,
|
|
|
ServeService: ServeService<D, PathBuf>,
|
|
|
ServePhp: ServePhp<D, PathBuf>,
|
|
|
|
|
|
|
|
|
ServePhp: ServePhp<D, PathBuf, FpmPoolConfig>,
|
|
|
ServeRedir: ServeRedir<D>,
|
|
|
ServeRedir: ServeRedir<D>,
|
|
|
ServeStatic: ServeStatic<D, PathBuf>,
|
|
|
ServeStatic: ServeStatic<D, PathBuf>,
|
|
|
StoredDirectory: StoredDirectory<PathBuf>,
|
|
|
StoredDirectory: StoredDirectory<PathBuf>,
|
|
@ -310,3 +318,8 @@ default_resources!( |
|
|
WordpressPlugin: WordpressPlugin<PathBuf>,
|
|
|
WordpressPlugin: WordpressPlugin<PathBuf>,
|
|
|
WordpressTranslation: WordpressTranslation<PathBuf>,
|
|
|
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> {
|
|
|
|
|
|
ServePhp(
|
|
|
|
|
|
domain, path.into(), root_filename, nginx_config.into(), pool_config.into())
|
|
|
|
|
|
}
|