File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,15 @@ impl Credentials {
6767 _ => return Err ( "SSH key not available" . into ( ) ) ,
6868 } ;
6969
70- // When running on production, ensure the file is created in tmpfs and not persisted to disk
71- # [ cfg ( target_os = "linux" ) ]
72- let mut temp_key_file = tempfile :: Builder :: new ( ) . tempfile_in ( "/dev/shm" ) ? ;
73-
74- // For other platforms, default to std::env::tempdir()
75- # [ cfg ( not ( target_os = "linux" ) ) ]
76- let mut temp_key_file = tempfile :: Builder :: new ( ) . tempfile ( ) ? ;
70+ let dir = if cfg ! ( target_os = "linux" ) {
71+ // When running on production, ensure the file is created in tmpfs and not persisted to disk
72+ "/dev/shm" . into ( )
73+ } else {
74+ // For other platforms, default to std::env::tempdir()
75+ std :: env :: temp_dir ( )
76+ } ;
7777
78+ let mut temp_key_file = tempfile:: Builder :: new ( ) . tempfile_in ( dir) ?;
7879 temp_key_file. write_all ( key. as_bytes ( ) ) ?;
7980
8081 Ok ( temp_key_file. into_temp_path ( ) )
You can’t perform that action at this time.
0 commit comments