File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,9 +82,9 @@ pub struct Args {
8282 #[ arg( long) ]
8383 graphql_schema_path : Option < PathBuf > ,
8484
85- /// If true, use cached permissions; otherwise, re-download and reparse Swagger files.
86- #[ arg( long) ]
87- cached_permissions : bool ,
85+ /// If true, disable cached permissions and re-download and reparse Swagger files.
86+ #[ arg( long, default_value_t = false ) ]
87+ no_cache : bool ,
8888
8989 /// Path to store or load cached permissions. If not provided, defaults to `~/.cache/fsrt`.
9090 #[ arg( long) ]
@@ -445,7 +445,23 @@ pub(crate) fn scan_directory<'a>(
445445 . collect :: < Vec < _ > > ( ) ;
446446
447447 let config = CacheConfig :: new (
448- opts. cached_permissions || std:: env:: var_os ( "FSRT_CACHE" ) . is_some_and ( |s| !s. is_empty ( ) ) ,
448+ if opts. no_cache {
449+ false
450+ } else {
451+ match std:: env:: var ( "FSRT_CACHE" ) {
452+ Err ( _) => true ,
453+ Ok ( s) => {
454+ let t = s. trim ( ) ;
455+ match t {
456+ "0" => false ,
457+ t if t. eq_ignore_ascii_case ( "false" ) => false ,
458+ "" | "1" => true ,
459+ t if t. eq_ignore_ascii_case ( "true" ) => true ,
460+ _ => true ,
461+ }
462+ }
463+ }
464+ } ,
449465 opts. cached_permissions_path . clone ( ) ,
450466 ) ;
451467
You can’t perform that action at this time.
0 commit comments