Skip to content

Commit ee7f798

Browse files
use system temp dir, which hopefully fixes things on windows
1 parent 7386b08 commit ee7f798

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ impl CertAuth {
5050
let keypair = rcgen::KeyPair::generate().unwrap();
5151
let cert = params.self_signed(&keypair).unwrap();
5252

53-
let path = "/tmp/fopro-ca.crt";
53+
let temp_dir = std::env::temp_dir();
54+
if !temp_dir.exists() {
55+
tracing::info!("Creating temp dir {temp_dir:?}");
56+
std::fs::create_dir_all(&temp_dir).unwrap();
57+
}
58+
let path = temp_dir.join("fopro-ca.crt");
59+
5460
tokio::fs::write(path, cert.pem()).await.unwrap();
5561
tracing::info!("Wrote CA cert to /tmp/fopro-ca.crt (in PEM format)");
5662

0 commit comments

Comments
 (0)