A library for writing host-specific, single-binary configuration management and deployment tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1021 B

use std::path::{Path, PathBuf};
use command_runner::CommandRunner;
use symbols::acme::AcmeAccountKey;
use symbols::dir::Dir;
use symbols::file::File;
use symbols::list::List;
use symbols::owner::Owner;
use symbols::Symbol;
pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str> + Clone, H: AsRef<Path>>(
command_runner: &'a R,
cert: C,
user_name: U,
home: H,
) -> impl Symbol + 'a {
let path = |rel: &str| [home.as_ref(), rel.as_ref()].iter().collect::<PathBuf>();
let account_key_file = path("account.key");
List::from((
AcmeAccountKey::new(account_key_file.clone(), command_runner),
Owner::new(
account_key_file,
user_name.clone(),
command_runner,
),
Dir::new(path("challenges")),
Owner::new(
path("challenges"),
user_name.clone(),
command_runner,
),
Dir::new("/etc/ssl/local_certs"),
Owner::new("/etc/ssl/local_certs", user_name, command_runner),
File::new(path("lets_encrypt_x3_cross_signed.pem"), cert),
))
}