Browse Source

Use clone in newAcmeUser

master
Adrian Heine 5 years ago
parent
commit
8bcd03c7da
  1. 7
      src/symbols/acme/user.rs
  2. 4
      src/symbols/factory.rs

7
src/symbols/acme/user.rs

@ -8,7 +8,7 @@ use symbols::list::List;
use symbols::owner::Owner; use symbols::owner::Owner;
use symbols::Symbol; use symbols::Symbol;
pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str>, H: AsRef<Path>>(
pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str> + Clone, H: AsRef<Path>>(
command_runner: &'a R, command_runner: &'a R,
cert: C, cert: C,
user_name: U, user_name: U,
@ -18,16 +18,15 @@ pub fn new<'a, R: CommandRunner, C: 'a + AsRef<str>, U: 'a + AsRef<str>, H: AsRe
let account_key_file = path("account.key"); let account_key_file = path("account.key");
List::from(( List::from((
AcmeAccountKey::new(account_key_file.clone(), command_runner), AcmeAccountKey::new(account_key_file.clone(), command_runner),
// FIXME into or cow or clone
Owner::new( Owner::new(
account_key_file, account_key_file,
user_name.as_ref().to_owned(),
user_name.clone(),
command_runner, command_runner,
), ),
Dir::new(path("challenges")), Dir::new(path("challenges")),
Owner::new( Owner::new(
path("challenges"), path("challenges"),
user_name.as_ref().to_owned(),
user_name.clone(),
command_runner, command_runner,
), ),
Dir::new("/etc/ssl/local_certs"), Dir::new("/etc/ssl/local_certs"),

4
src/symbols/factory.rs

@ -341,13 +341,13 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
Cron::new(user, content, self.command_runner) Cron::new(user, content, self.command_runner)
} }
pub fn get_acme_user<'a, S: 'a + AsRef<str>, D: 'a + AsRef<str>>(
pub fn get_acme_user<'a, S: 'a + AsRef<str> + Clone, D: 'a + AsRef<str>>(
&'a self, &'a self,
cert: D, cert: D,
user_name: S, user_name: S,
) -> impl Symbol + 'a { ) -> impl Symbol + 'a {
let home = self.policy.home_for_user(user_name.as_ref()); let home = self.policy.home_for_user(user_name.as_ref());
newAcmeUser(self.command_runner, cert, user_name, home)
newAcmeUser(self.command_runner, cert, user_name.clone(), home)
} }
pub fn get_systemd_user_service<'a>( pub fn get_systemd_user_service<'a>(

Loading…
Cancel
Save