@@ -76,6 +76,13 @@ public function __construct() {
7676 $ hcpp ->add_action ( 'hcpp_rebooted ' , [ $ this , 'hcpp_rebooted ' ] );
7777 $ hcpp ->add_action ( 'hcpp_runuser ' , [ $ this , 'hcpp_runuser ' ] );
7878 $ hcpp ->add_action ( 'v_restart_proxy ' , [ $ this , 'v_restart_proxy ' ] );
79+
80+ // Rewrite config files on ssl related events
81+ $ hcpp ->add_action ( 'v_add_web_domain_ssl ' , [ $ this , 'update_nginx_files ' ] );
82+ $ hcpp ->add_action ( 'v_delete_web_domain_ssl ' , [ $ this , 'update_nginx_files ' ] );
83+ $ hcpp ->add_action ( 'v_add_web_domain_ssl_force ' , [ $ this , 'update_nginx_files ' ] );
84+ $ hcpp ->add_action ( 'v_delete_web_domain_ssl_force ' , [ $ this , 'update_nginx_files ' ] );
85+
7986 $ hcpp ->add_custom_page ( 'nodeapp ' , __DIR__ . '/pages/nodeapp.php ' );
8087 $ hcpp ->add_custom_page ( 'nodeapplog ' , __DIR__ . '/pages/nodeapplog.php ' );
8188 }
@@ -829,6 +836,19 @@ public function update_all() {
829836 }, $ majors );
830837 }
831838
839+ /**
840+ * Update the nginx config files for the given user and domain
841+ */
842+ public function update_nginx_files ( $ args ) {
843+ global $ hcpp ;
844+ $ user = $ args [0 ];
845+ $ domain = $ args [1 ];
846+ $ nodeapp_folder = "/home/ $ user/web/ $ domain/nodeapp " ;
847+ if ( is_dir ( $ nodeapp_folder ) ) {
848+ $ this ->generate_nginx_files ( $ nodeapp_folder , true );
849+ }
850+ }
851+
832852 /**
833853 * On proxy template change, copy basic nodeapp, allocate ports, and start apps
834854 */
0 commit comments