|
|
@ -41,7 +41,8 @@ use crate::templates::systemd::{ |
|
|
|
};
|
|
|
|
use crate::to_artifact::ToArtifact;
|
|
|
|
use std::fmt::Display;
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use std::path::Path;
|
|
|
|
use std::rc::Rc;
|
|
|
|
|
|
|
|
pub trait ImplementationBuilder<R> {
|
|
|
|
type Prerequisites: ToArtifact;
|
|
|
@ -64,13 +65,13 @@ impl<D> ImplementationBuilder<Key<D>> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &Key<D>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = KeySymbol<StdCommandRunner, PathBuf>;
|
|
|
|
type Implementation = KeySymbol<StdCommandRunner, Rc<Path>>;
|
|
|
|
fn create(
|
|
|
|
_resource: &Key<D>,
|
|
|
|
target: &<Key<D> as Resource>::Artifact,
|
|
|
|
(): <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
KeySymbol::new(StdCommandRunner, target.clone().into())
|
|
|
|
KeySymbol::new(StdCommandRunner, target.clone_rc())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -80,7 +81,7 @@ impl<D: Clone> ImplementationBuilder<Csr<D>> for DefaultBuilder { |
|
|
|
Key(resource.0.clone())
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = CsrSymbol<StdCommandRunner, D, PathBuf, PathBuf>;
|
|
|
|
type Implementation = CsrSymbol<StdCommandRunner, D, Rc<Path>, Rc<Path>>;
|
|
|
|
fn create(
|
|
|
|
resource: &Csr<D>,
|
|
|
|
target: &<Csr<D> as Resource>::Artifact,
|
|
|
@ -89,8 +90,8 @@ impl<D: Clone> ImplementationBuilder<Csr<D>> for DefaultBuilder { |
|
|
|
CsrSymbol::new(
|
|
|
|
StdCommandRunner,
|
|
|
|
resource.0.clone(),
|
|
|
|
key.into(),
|
|
|
|
target.clone().into(),
|
|
|
|
key.clone_rc(),
|
|
|
|
target.clone_rc(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -116,7 +117,7 @@ impl<D: Clone> ImplementationBuilder<Cert<D>> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation =
|
|
|
|
CertSymbol<SetuidCommandRunner<String>, SetuidCommandRunner<String>, D, PathBuf>;
|
|
|
|
CertSymbol<SetuidCommandRunner<Rc<str>>, SetuidCommandRunner<Rc<str>>, D, Rc<Path>>;
|
|
|
|
fn create(
|
|
|
|
resource: &Cert<D>,
|
|
|
|
target: &<Cert<D> as Resource>::Artifact,
|
|
|
@ -125,11 +126,11 @@ impl<D: Clone> ImplementationBuilder<Cert<D>> for DefaultBuilder { |
|
|
|
CertSymbol::new(
|
|
|
|
resource.0.clone(),
|
|
|
|
SetuidCommandRunner::new(user_name.0),
|
|
|
|
root_cert.into(),
|
|
|
|
account_key.into(),
|
|
|
|
challenges_dir.into(),
|
|
|
|
csr.into(),
|
|
|
|
target.clone().into(),
|
|
|
|
root_cert.clone_rc(),
|
|
|
|
account_key.clone_rc(),
|
|
|
|
challenges_dir.clone_rc(),
|
|
|
|
csr.clone_rc(),
|
|
|
|
target.clone_rc(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -140,13 +141,13 @@ impl<D: Clone> ImplementationBuilder<CertChain<D>> for DefaultBuilder { |
|
|
|
(Cert(resource.0.clone()), AcmeRootCert)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = ConcatSymbol<[PathBuf; 2], PathBuf, PathBuf>;
|
|
|
|
type Implementation = ConcatSymbol<[Rc<Path>; 2], Rc<Path>, Rc<Path>>;
|
|
|
|
fn create(
|
|
|
|
_resource: &CertChain<D>,
|
|
|
|
target: &<CertChain<D> as Resource>::Artifact,
|
|
|
|
(cert, root_cert): <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
ConcatSymbol::new([cert.into(), root_cert.into()], target.clone().into())
|
|
|
|
ConcatSymbol::new([cert.clone_rc(), root_cert.clone_rc()], target.clone_rc())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -156,13 +157,13 @@ impl<D: Clone> ImplementationBuilder<KeyAndCertBundle<D>> for DefaultBuilder { |
|
|
|
(CertChain(resource.0.clone()), Key(resource.0.clone()))
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = ConcatSymbol<[PathBuf; 2], PathBuf, PathBuf>;
|
|
|
|
type Implementation = ConcatSymbol<[Rc<Path>; 2], Rc<Path>, Rc<Path>>;
|
|
|
|
fn create(
|
|
|
|
_resource: &KeyAndCertBundle<D>,
|
|
|
|
target: &<KeyAndCertBundle<D> as Resource>::Artifact,
|
|
|
|
(cert_chain, key): <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
ConcatSymbol::new([key.into(), cert_chain.into()], target.clone().into())
|
|
|
|
ConcatSymbol::new([key.clone_rc(), cert_chain.clone_rc()], target.clone_rc())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -170,7 +171,7 @@ impl<P: AsRef<Path> + Clone> ImplementationBuilder<File<P>> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &File<P>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = FileSymbol<P, String>;
|
|
|
|
type Implementation = FileSymbol<P, Rc<str>>;
|
|
|
|
fn create(
|
|
|
|
resource: &File<P>,
|
|
|
|
_target: &<File<P> as Resource>::Artifact,
|
|
|
@ -201,7 +202,7 @@ impl ImplementationBuilder<DefaultServer> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -211,8 +212,8 @@ impl ImplementationBuilder<DefaultServer> for DefaultBuilder { |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
nginx::default_server(challenges_snippet_path),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::default_server(challenges_snippet_path).into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -230,7 +231,7 @@ impl<D: AsRef<str> + Clone + Display> ImplementationBuilder<ServeCustom<D>> for |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -240,8 +241,8 @@ impl<D: AsRef<str> + Clone + Display> ImplementationBuilder<ServeCustom<D>> for |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
nginx::server_config(&resource.0, cert, key, &resource.1, challenges_snippet_path),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::server_config(&resource.0, cert, key, &resource.1, challenges_snippet_path).into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -267,7 +268,7 @@ impl<D: Clone + Display, P: AsRef<Path>, C: Clone + Into<PhpFpmPoolConfig>> |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -277,14 +278,15 @@ impl<D: Clone + Display, P: AsRef<Path>, C: Clone + Into<PhpFpmPoolConfig>> |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::server_config(
|
|
|
|
&resource.0,
|
|
|
|
cert,
|
|
|
|
key,
|
|
|
|
nginx::php_snippet(resource.2, pool.0, &resource.1) + &resource.3,
|
|
|
|
challenges_snippet_path,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -316,7 +318,7 @@ impl<D: Clone + Display, P: Clone + AsRef<Path>> ImplementationBuilder<ServeServ |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -326,14 +328,15 @@ impl<D: Clone + Display, P: Clone + AsRef<Path>> ImplementationBuilder<ServeServ |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::server_config(
|
|
|
|
&resource.0,
|
|
|
|
cert,
|
|
|
|
key,
|
|
|
|
nginx::proxy_snippet(&socket.0, &resource.3),
|
|
|
|
challenges_snippet_path,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -351,7 +354,7 @@ impl<D: AsRef<str> + Clone + Display> ImplementationBuilder<ServeRedir<D>> for D |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -361,14 +364,15 @@ impl<D: AsRef<str> + Clone + Display> ImplementationBuilder<ServeRedir<D>> for D |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::server_config(
|
|
|
|
&resource.0,
|
|
|
|
cert,
|
|
|
|
key,
|
|
|
|
nginx::redir_snippet(resource.1.as_ref()),
|
|
|
|
challenges_snippet_path,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -388,7 +392,7 @@ impl<D: AsRef<str> + Clone + Display, P: AsRef<Path>> ImplementationBuilder<Serv |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, &'static str>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
@ -398,14 +402,15 @@ impl<D: AsRef<str> + Clone + Display, P: AsRef<Path>> ImplementationBuilder<Serv |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::server_config(
|
|
|
|
&resource.0,
|
|
|
|
cert,
|
|
|
|
key,
|
|
|
|
nginx::static_snippet(resource.1.as_ref()),
|
|
|
|
challenges_snippet_path,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, "nginx"),
|
|
|
|
)
|
|
|
@ -417,8 +422,8 @@ impl<D: Clone> ImplementationBuilder<PhpFpmPool<D>> for DefaultBuilder { |
|
|
|
fn prerequisites(_resource: &PhpFpmPool<D>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
ReloadServiceSymbol<StdCommandRunner, StdCommandRunner, Rc<str>>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
|
resource: &PhpFpmPool<D>,
|
|
|
@ -427,8 +432,8 @@ impl<D: Clone> ImplementationBuilder<PhpFpmPool<D>> for DefaultBuilder { |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
conf_path.clone().into(),
|
|
|
|
php_fpm_pool_config(&user_name.0, socket_path, &resource.1),
|
|
|
|
conf_path.clone_rc(),
|
|
|
|
php_fpm_pool_config(&user_name.0, socket_path, &resource.1).into(),
|
|
|
|
),
|
|
|
|
ReloadServiceSymbol::new(StdCommandRunner, service_name.0.clone()),
|
|
|
|
)
|
|
|
@ -441,10 +446,10 @@ impl<D, P: AsRef<Path>> ImplementationBuilder<SystemdSocketService<D, P>> for De |
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
// First three could be parallel
|
|
|
|
FileSymbol<PathBuf, String>,
|
|
|
|
SystemdUserSessionSymbol<'static, String, StdCommandRunner>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, PathBuf, String>,
|
|
|
|
UserServiceSymbol<'static, PathBuf, String>,
|
|
|
|
FileSymbol<Rc<Path>, Box<str>>,
|
|
|
|
SystemdUserSessionSymbol<'static, Rc<str>, StdCommandRunner>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, Box<Path>, Rc<str>>,
|
|
|
|
UserServiceSymbol<'static, Rc<Path>, Rc<str>>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
|
resource: &SystemdSocketService<D, P>,
|
|
|
@ -453,7 +458,7 @@ impl<D, P: AsRef<Path>> ImplementationBuilder<SystemdSocketService<D, P>> for De |
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
FileSymbol::new(
|
|
|
|
conf_path.clone().into(),
|
|
|
|
conf_path.clone_rc(),
|
|
|
|
if resource.4 {
|
|
|
|
systemd_nodejs_service(&resource.2, socket_path, &resource.3)
|
|
|
|
} else {
|
|
|
@ -463,15 +468,16 @@ impl<D, P: AsRef<Path>> ImplementationBuilder<SystemdSocketService<D, P>> for De |
|
|
|
&resource.3,
|
|
|
|
"",
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
.into(),
|
|
|
|
),
|
|
|
|
SystemdUserSessionSymbol::new(user_name.0.clone(), &StdCommandRunner),
|
|
|
|
OwnerSymbol::new(
|
|
|
|
conf_path.as_ref().parent().unwrap().to_path_buf(),
|
|
|
|
conf_path.as_ref().parent().unwrap().into(),
|
|
|
|
user_name.0.clone(),
|
|
|
|
StdCommandRunner,
|
|
|
|
),
|
|
|
|
UserServiceSymbol::new(socket_path.clone().into(), user_name.0.clone(), resource.1),
|
|
|
|
UserServiceSymbol::new(socket_path.clone_rc(), user_name.0.clone(), resource.1),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -516,7 +522,7 @@ impl<P: Clone + AsRef<Path>> ImplementationBuilder<StoredDirectory<P>> for Defau |
|
|
|
) -> Self::Implementation {
|
|
|
|
SavedDirectorySymbol::new(
|
|
|
|
resource.1.clone(),
|
|
|
|
SimpleStorage::new(target.clone().into()),
|
|
|
|
SimpleStorage::new(target.clone_rc()),
|
|
|
|
StorageDirection::Store,
|
|
|
|
StdCommandRunner,
|
|
|
|
)
|
|
|
@ -535,7 +541,7 @@ impl<P: Clone + AsRef<Path>> ImplementationBuilder<LoadedDirectory<P>> for Defau |
|
|
|
) -> Self::Implementation {
|
|
|
|
SavedDirectorySymbol::new(
|
|
|
|
resource.1.clone(),
|
|
|
|
SimpleStorage::new(target.clone().into()),
|
|
|
|
SimpleStorage::new(target.clone_rc()),
|
|
|
|
StorageDirection::Load,
|
|
|
|
StdCommandRunner,
|
|
|
|
)
|
|
|
@ -546,7 +552,7 @@ impl<D: Clone> ImplementationBuilder<UserForDomain<D>> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &UserForDomain<D>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = UserSymbol<String, StdCommandRunner>;
|
|
|
|
type Implementation = UserSymbol<Rc<str>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
_resource: &UserForDomain<D>,
|
|
|
|
(user_name, _home_path): &<UserForDomain<D> as Resource>::Artifact,
|
|
|
@ -560,7 +566,7 @@ impl ImplementationBuilder<User> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &User) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = UserSymbol<String, StdCommandRunner>;
|
|
|
|
type Implementation = UserSymbol<Rc<str>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
resource: &User,
|
|
|
|
(): &<User as Resource>::Artifact,
|
|
|
@ -574,7 +580,7 @@ impl<P: AsRef<Path> + Clone> ImplementationBuilder<Owner<P>> for DefaultBuilder |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &Owner<P>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = OwnerSymbol<StdCommandRunner, StdCommandRunner, P, String>;
|
|
|
|
type Implementation = OwnerSymbol<StdCommandRunner, StdCommandRunner, P, Rc<str>>;
|
|
|
|
fn create(
|
|
|
|
resource: &Owner<P>,
|
|
|
|
(): &<Owner<P> as Resource>::Artifact,
|
|
|
@ -588,7 +594,7 @@ impl ImplementationBuilder<AcmeUser> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &AcmeUser) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = UserSymbol<String, StdCommandRunner>;
|
|
|
|
type Implementation = UserSymbol<Rc<str>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
_resource: &AcmeUser,
|
|
|
|
user_name: &<AcmeUser as Resource>::Artifact,
|
|
|
@ -605,8 +611,8 @@ impl ImplementationBuilder<AcmeChallengesDir> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
DirSymbol<PathBuf>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, PathBuf, String>,
|
|
|
|
DirSymbol<Rc<Path>>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, Rc<Path>, Rc<str>>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
|
_resource: &AcmeChallengesDir,
|
|
|
@ -614,8 +620,8 @@ impl ImplementationBuilder<AcmeChallengesDir> for DefaultBuilder { |
|
|
|
user_name: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
DirSymbol::new(target.clone().into()),
|
|
|
|
OwnerSymbol::new(target.clone().into(), user_name.0, StdCommandRunner),
|
|
|
|
DirSymbol::new(target.clone_rc()),
|
|
|
|
OwnerSymbol::new(target.clone_rc(), user_name.0, StdCommandRunner),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -626,15 +632,15 @@ impl ImplementationBuilder<AcmeChallengesNginxSnippet> for DefaultBuilder { |
|
|
|
AcmeChallengesDir
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = FileSymbol<PathBuf, String>;
|
|
|
|
type Implementation = FileSymbol<Rc<Path>, Box<str>>;
|
|
|
|
fn create(
|
|
|
|
_resource: &AcmeChallengesNginxSnippet,
|
|
|
|
target: &<AcmeChallengesNginxSnippet as Resource>::Artifact,
|
|
|
|
challenges_dir: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
FileSymbol::new(
|
|
|
|
target.clone().into(),
|
|
|
|
nginx::acme_challenges_snippet(challenges_dir),
|
|
|
|
target.clone_rc(),
|
|
|
|
nginx::acme_challenges_snippet(challenges_dir).into(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -646,8 +652,8 @@ impl ImplementationBuilder<AcmeAccountKey> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
KeySymbol<StdCommandRunner, PathBuf>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, PathBuf, String>,
|
|
|
|
KeySymbol<StdCommandRunner, Rc<Path>>,
|
|
|
|
OwnerSymbol<StdCommandRunner, StdCommandRunner, Rc<Path>, Rc<str>>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
|
_resource: &AcmeAccountKey,
|
|
|
@ -655,8 +661,8 @@ impl ImplementationBuilder<AcmeAccountKey> for DefaultBuilder { |
|
|
|
user_name: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
(
|
|
|
|
KeySymbol::new(StdCommandRunner, target.clone().into()),
|
|
|
|
OwnerSymbol::new(target.clone().into(), user_name.0, StdCommandRunner),
|
|
|
|
KeySymbol::new(StdCommandRunner, target.clone_rc()),
|
|
|
|
OwnerSymbol::new(target.clone_rc(), user_name.0, StdCommandRunner),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -665,13 +671,13 @@ impl ImplementationBuilder<AcmeRootCert> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &AcmeRootCert) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = FileSymbol<PathBuf, &'static str>;
|
|
|
|
type Implementation = FileSymbol<Rc<Path>, &'static str>;
|
|
|
|
fn create(
|
|
|
|
_resource: &AcmeRootCert,
|
|
|
|
target: &<AcmeRootCert as Resource>::Artifact,
|
|
|
|
(): <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
FileSymbol::new(target.clone().into(), LETS_ENCRYPT_R3)
|
|
|
|
FileSymbol::new(target.clone_rc(), LETS_ENCRYPT_R3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -679,7 +685,7 @@ impl<D> ImplementationBuilder<MariaDbUser<D>> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_resource: &MariaDbUser<D>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = MariaDbUserSymbol<'static, String, StdCommandRunner>;
|
|
|
|
type Implementation = MariaDbUserSymbol<'static, Rc<str>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
_resource: &MariaDbUser<D>,
|
|
|
|
user_name: &<MariaDbUser<D> as Resource>::Artifact,
|
|
|
@ -696,15 +702,15 @@ impl<D: Clone> ImplementationBuilder<MariaDbDatabase<D>> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = (
|
|
|
|
MariaDbDatabaseSymbol<'static, String, SimpleStorage, StdCommandRunner>,
|
|
|
|
MariaDbDumpSymbol<'static, String, StdCommandRunner, SimpleStorage>,
|
|
|
|
MariaDbDatabaseSymbol<'static, Rc<str>, SimpleStorage, StdCommandRunner>,
|
|
|
|
MariaDbDumpSymbol<'static, Rc<str>, StdCommandRunner, SimpleStorage>,
|
|
|
|
);
|
|
|
|
fn create(
|
|
|
|
_resource: &MariaDbDatabase<D>,
|
|
|
|
(db_name, _, data_path): &<MariaDbDatabase<D> as Resource>::Artifact,
|
|
|
|
_: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
let db_dump = SimpleStorage::new(data_path.clone().into());
|
|
|
|
let db_dump = SimpleStorage::new(data_path.clone_rc());
|
|
|
|
(
|
|
|
|
MariaDbDatabaseSymbol::new(db_name.0.clone(), db_dump.clone(), &StdCommandRunner),
|
|
|
|
MariaDbDumpSymbol::new(db_name.0.clone(), db_dump, &StdCommandRunner),
|
|
|
@ -716,13 +722,13 @@ impl<D: Clone> ImplementationBuilder<PostgresqlDatabase<D>> for DefaultBuilder { |
|
|
|
type Prerequisites = ();
|
|
|
|
fn prerequisites(_: &PostgresqlDatabase<D>) -> Self::Prerequisites {}
|
|
|
|
|
|
|
|
type Implementation = (PostgreSQLDatabaseSymbol<'static, String, String, StdCommandRunner>,);
|
|
|
|
type Implementation = (PostgreSQLDatabaseSymbol<'static, Rc<str>, Rc<str>, StdCommandRunner>,);
|
|
|
|
fn create(
|
|
|
|
_resource: &PostgresqlDatabase<D>,
|
|
|
|
(db_name, data_path): &<PostgresqlDatabase<D> as Resource>::Artifact,
|
|
|
|
_: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
let db_dump = SimpleStorage::new(data_path.clone().into());
|
|
|
|
let db_dump = SimpleStorage::new(data_path.clone_rc());
|
|
|
|
(PostgreSQLDatabaseSymbol::new(
|
|
|
|
db_name.0.clone(),
|
|
|
|
db_dump.read_filename().unwrap().to_str().unwrap().into(),
|
|
|
@ -732,9 +738,9 @@ impl<D: Clone> ImplementationBuilder<PostgresqlDatabase<D>> for DefaultBuilder { |
|
|
|
}
|
|
|
|
|
|
|
|
impl<P: Clone + AsRef<Path>> ImplementationBuilder<WordpressPlugin<P>> for DefaultBuilder {
|
|
|
|
type Prerequisites = Dir<PathBuf>;
|
|
|
|
type Prerequisites = Dir<Rc<Path>>;
|
|
|
|
fn prerequisites(resource: &WordpressPlugin<P>) -> Self::Prerequisites {
|
|
|
|
Dir(resource.0.as_ref().join("wp-content/plugins"))
|
|
|
|
Dir::new(resource.0.as_ref().join("wp-content/plugins"))
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = WordpressPluginSymbol<'static, P, &'static str, StdCommandRunner>;
|
|
|
@ -747,21 +753,21 @@ impl<P: Clone + AsRef<Path>> ImplementationBuilder<WordpressPlugin<P>> for Defau |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<P: Clone + AsRef<Path>> ImplementationBuilder<WordpressTranslation<P>> for DefaultBuilder {
|
|
|
|
type Prerequisites = Dir<PathBuf>;
|
|
|
|
impl<P: AsRef<Path>> ImplementationBuilder<WordpressTranslation<P>> for DefaultBuilder {
|
|
|
|
type Prerequisites = Dir<Rc<Path>>;
|
|
|
|
fn prerequisites(resource: &WordpressTranslation<P>) -> Self::Prerequisites {
|
|
|
|
Dir(resource.0.as_ref().join("wp-content/languages"))
|
|
|
|
Dir::new(resource.0.as_ref().join("wp-content/languages"))
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation =
|
|
|
|
WordpressTranslationSymbol<'static, &'static str, PathBuf, StdCommandRunner>;
|
|
|
|
WordpressTranslationSymbol<'static, &'static str, Box<Path>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
resource: &WordpressTranslation<P>,
|
|
|
|
(): &<WordpressTranslation<P> as Resource>::Artifact,
|
|
|
|
_: <Self::Prerequisites as ToArtifact>::Artifact,
|
|
|
|
) -> Self::Implementation {
|
|
|
|
WordpressTranslationSymbol::new(
|
|
|
|
resource.0.as_ref().join("wp-content/languages"),
|
|
|
|
(*resource.0.as_ref().join("wp-content/languages")).into(),
|
|
|
|
resource.1,
|
|
|
|
resource.2,
|
|
|
|
&StdCommandRunner,
|
|
|
@ -775,7 +781,7 @@ impl<D: Clone> ImplementationBuilder<Cron<D>> for DefaultBuilder { |
|
|
|
UserForDomain(resource.0.clone())
|
|
|
|
}
|
|
|
|
|
|
|
|
type Implementation = CronSymbol<'static, String, String, StdCommandRunner>;
|
|
|
|
type Implementation = CronSymbol<'static, Box<str>, Rc<str>, StdCommandRunner>;
|
|
|
|
fn create(
|
|
|
|
resource: &Cron<D>,
|
|
|
|
(): &<Cron<D> as Resource>::Artifact,
|
|
|
|