@@ -327,24 +327,23 @@ impl Firewall {
327
327
}
328
328
329
329
pub fn save_rules ( & self ) -> AppResult < ( ) > {
330
- if !self . rules . is_empty ( ) {
331
- info ! ( "Saving Firewall Rules" ) ;
330
+ info ! ( "Saving Firewall Rules" ) ;
332
331
333
- let json = serde_json:: to_string ( & self . rules ) ?;
332
+ let json = serde_json:: to_string ( & self . rules ) ?;
334
333
335
- let user_uid = unsafe { libc:: geteuid ( ) } ;
334
+ let user_uid = unsafe { libc:: geteuid ( ) } ;
336
335
337
- let oryx_export_dir = dirs:: home_dir ( ) . unwrap ( ) . join ( "oryx" ) ;
336
+ let oryx_export_dir = dirs:: home_dir ( ) . unwrap ( ) . join ( "oryx" ) ;
338
337
339
- if !oryx_export_dir. exists ( ) {
340
- fs:: create_dir ( & oryx_export_dir) ?;
341
- chown ( & oryx_export_dir, Some ( user_uid) , Some ( user_uid) ) ?;
342
- }
343
-
344
- let oryx_export_file = oryx_export_dir. join ( "firewall.json" ) ;
345
- fs:: write ( oryx_export_file, json) ?;
346
- info ! ( "Firewall Rules saved" ) ;
338
+ if !oryx_export_dir. exists ( ) {
339
+ fs:: create_dir ( & oryx_export_dir) ?;
340
+ chown ( & oryx_export_dir, Some ( user_uid) , Some ( user_uid) ) ?;
347
341
}
342
+
343
+ let oryx_export_file = oryx_export_dir. join ( "firewall.json" ) ;
344
+ fs:: write ( oryx_export_file, json) ?;
345
+ info ! ( "Firewall Rules saved" ) ;
346
+
348
347
Ok ( ( ) )
349
348
}
350
349
0 commit comments