mirror of
https://github.com/samsonjs/agate.git
synced 2026-03-25 09:05:50 +00:00
Simplify code for cert file paths
This commit is contained in:
parent
b0d30df91a
commit
ef39d78f08
1 changed files with 6 additions and 8 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -313,17 +313,15 @@ fn args() -> Result<Args> {
|
|||
let cert = cert_params.self_signed(&key_pair)?;
|
||||
|
||||
// make sure the certificate directory exists
|
||||
fs::create_dir(certs_path.join(domain))?;
|
||||
let cert_dir = certs_path.join(domain);
|
||||
fs::create_dir(&cert_dir)?;
|
||||
|
||||
// write certificate data to disk
|
||||
let mut cert_file = File::create(certs_path.join(format!(
|
||||
"{}/{}",
|
||||
domain,
|
||||
certificates::CERT_FILE_NAME
|
||||
)))?;
|
||||
let mut cert_file = File::create(cert_dir.join(certificates::CERT_FILE_NAME))?;
|
||||
cert_file.write_all(cert.der())?;
|
||||
|
||||
// write key data to disk
|
||||
let key_file_path =
|
||||
certs_path.join(format!("{}/{}", domain, certificates::KEY_FILE_NAME));
|
||||
let key_file_path = cert_dir.join(certificates::KEY_FILE_NAME);
|
||||
let mut key_file = File::create(&key_file_path)?;
|
||||
#[cfg(unix)]
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue