@ -47,7 +47,7 @@ impl<'b, C: 'b + CommandRunner, R: 'b + SymbolRunner, P: 'b + Policy> SymbolFact
SymbolFactory { command_runner , acme_command_runner , symbol_runner , policy }
}
pub fn get_nginx_acme_server < 'a , 'c : 'a , S : 'a + Symbol > ( & 'c self , host : & 'static str , nginx_server_symbol : S ) -> Box < Action + 'a > {
pub fn get_nginx_acme_server < 'a , 'c : 'a , S : 'a + Symbol > ( & 'c self , host : & 'static str , nginx_server_symbol : S ) -> Box < dyn Action + 'a > {
Box ::new ( ListAction ::new ( vec ! [
Box ::new ( SelfSignedTlsCert ::new (
host . into ( ) ,
@ -70,7 +70,7 @@ impl<'b, C: 'b + CommandRunner, R: 'b + SymbolRunner, P: 'b + Policy> SymbolFact
) ) . into_action ( self . symbol_runner )
] ) )
}
pub fn get_nginx_acme_challenge_config < 'a > ( & 'a self ) -> Box < Action + 'a > {
pub fn get_nginx_acme_challenge_config < 'a > ( & 'a self ) -> Box < dyn Action + 'a > {
Box ::new ( File ::new (
"/etc/nginx/snippets/acme-challenge.conf" , " location ^ ~ / . well - known / acme - challenge / {
alias / home / acme / challenges / ;
@ -83,7 +83,7 @@ impl<'b, C: 'b + CommandRunner, R: 'b + SymbolRunner, P: 'b + Policy> SymbolFact
format ! ( "/run/php/{}.sock" , user_name )
}
fn get_php_fpm_pool < 'a > ( & 'a self , user_name : & str ) -> Box < Action + 'a > {
fn get_php_fpm_pool < 'a > ( & 'a self , user_name : & str ) -> Box < dyn Action + 'a > {
let socket = self . get_php_fpm_pool_socket_path ( user_name ) ;
Box ::new ( Hook ::new (
File ::new (
@ -105,7 +105,7 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
) ) . into_action ( self . symbol_runner )
}
pub fn serve_php < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < Action + 'a > {
pub fn serve_php < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < dyn Action + 'a > {
let user_name = self . policy . user_name_for_host ( host_name ) ;
let socket = self . get_php_fpm_pool_socket_path ( & user_name ) ;
Box ::new ( ListAction ::new ( vec ! [
@ -121,7 +121,7 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
] ) )
}
pub fn serve_wordpress < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < Action + 'a > {
pub fn serve_wordpress < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < dyn Action + 'a > {
let user_name = self . policy . user_name_for_host ( host_name ) ;
let socket = self . get_php_fpm_pool_socket_path ( & user_name ) ;
Box ::new ( ListAction ::new ( vec ! [
@ -139,7 +139,7 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
] ) )
}
pub fn serve_dokuwiki < 'a > ( & 'a self , host_name : & 'static str , root_dir : & 'static str ) -> Box < Action + 'a > {
pub fn serve_dokuwiki < 'a > ( & 'a self , host_name : & 'static str , root_dir : & 'static str ) -> Box < dyn Action + 'a > {
let user_name = self . policy . user_name_for_host ( host_name ) ;
let socket = self . get_php_fpm_pool_socket_path ( & user_name ) ;
Box ::new ( ListAction ::new ( vec ! [
@ -174,7 +174,7 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
] ) )
}
pub fn serve_nextcloud < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < Action + 'a > {
pub fn serve_nextcloud < 'a > ( & 'a self , host_name : & 'static str , root_dir : Cow < 'a , str > ) -> Box < dyn Action + 'a > {
let user_name = self . policy . user_name_for_host ( host_name ) ;
let socket = self . get_php_fpm_pool_socket_path ( & user_name ) ;
Box ::new ( ListAction ::new ( vec ! [
@ -236,15 +236,15 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
] ) )
}
pub fn serve_redir < 'a > ( & 'a self , host_name : & 'static str , target : & 'static str ) -> Box < Action + 'a > {
pub fn serve_redir < 'a > ( & 'a self , host_name : & 'static str , target : & 'static str ) -> Box < dyn Action + 'a > {
self . get_nginx_acme_server ( host_name , NginxServer ::new_redir ( host_name , target , self . command_runner ) )
}
pub fn serve_static < 'a > ( & 'a self , host_name : & 'static str , dir : & 'a str ) -> Box < Action + 'a > {
pub fn serve_static < 'a > ( & 'a self , host_name : & 'static str , dir : & 'a str ) -> Box < dyn Action + 'a > {
self . get_nginx_acme_server ( host_name , NginxServer ::new_static ( host_name , dir , self . command_runner ) )
}
pub fn get_stored_directory < 'a , T : Into < String > > ( & 'a self , storage_name : & 'static str , target : T ) -> ( Box < Action + 'a > , Box < Action + 'a > ) {
pub fn get_stored_directory < 'a , T : Into < String > > ( & 'a self , storage_name : & 'static str , target : T ) -> ( Box < dyn Action + 'a > , Box < dyn Action + 'a > ) {
let data = SimpleStorage ::new ( "/root/data" . to_string ( ) , storage_name . to_string ( ) ) ;
let string_target = target . into ( ) ;
(
@ -253,7 +253,7 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
)
}
pub fn get_mariadb_database < 'a > ( & 'a self , name : & 'static str ) -> Box < Action + 'a > {
pub fn get_mariadb_database < 'a > ( & 'a self , name : & 'static str ) -> Box < dyn Action + 'a > {
let db_dump = SimpleStorage ::new ( "/root/data" . to_string ( ) , format ! ( "{}.sql" , name ) ) ;
Box ::new ( ListAction ::new ( vec ! [
Box ::new ( MariaDBDatabase ::new ( name . into ( ) , db_dump . read_filename ( ) . unwrap ( ) . into ( ) , self . command_runner ) ) . into_action ( self . symbol_runner ) ,
@ -261,19 +261,19 @@ env[PATH] = /usr/local/bin:/usr/bin:/bin
] ) )
}
pub fn get_mariadb_user < 'a > ( & 'a self , user_name : & 'static str ) -> Box < Action + 'a > {
pub fn get_mariadb_user < 'a > ( & 'a self , user_name : & 'static str ) -> Box < dyn Action + 'a > {
Box ::new ( MariaDBUser ::new ( user_name . into ( ) , self . command_runner ) ) . into_action ( self . symbol_runner )
}
pub fn get_git_checkout < 'a , T : 'a + AsRef < str > > ( & 'a self , target : T , source : & 'a str , branch : & 'a str ) -> Box < Action + 'a > {
pub fn get_git_checkout < 'a , T : 'a + AsRef < str > > ( & 'a self , target : T , source : & 'a str , branch : & 'a str ) -> Box < dyn Action + 'a > {
Box ::new ( GitCheckout ::new ( target , source , branch , self . command_runner ) ) . into_action ( self . symbol_runner )
}
pub fn get_owner < 'a , F : 'a + AsRef < str > > ( & 'a self , file : F , user : & 'a str ) -> Box < Action + 'a > {
pub fn get_owner < 'a , F : 'a + AsRef < str > > ( & 'a self , file : F , user : & 'a str ) -> Box < dyn Action + 'a > {
Box ::new ( Owner ::new ( file , user . into ( ) , self . command_runner ) ) . into_action ( self . symbol_runner )
}
pub fn get_file < 'a , F : 'a + Deref < Target = str > , Q : 'a + AsRef < Path > > ( & 'a self , path : Q , content : F ) -> Box < Action + 'a > {
pub fn get_file < 'a , F : 'a + Deref < Target = str > , Q : 'a + AsRef < Path > > ( & 'a self , path : Q , content : F ) -> Box < dyn Action + 'a > {
Box ::new ( File ::new ( path , content ) ) . into_action ( self . symbol_runner )
}
}