Generate server certificate
This commit is contained in:
@ -7,15 +7,15 @@ use std::path::{Path, PathBuf};
|
||||
pub struct AppConfig {
|
||||
/// The port the server will listen to (using HTTPS)
|
||||
#[arg(short, long, env, default_value = "0.0.0.0:8443")]
|
||||
listen_address: String,
|
||||
pub listen_address: String,
|
||||
|
||||
/// The port the server will listen to (using HTTP, for unsecure connections)
|
||||
#[arg(short, long, env, default_value = "0.0.0.0:8080")]
|
||||
unsecure_listen_address: String,
|
||||
pub unsecure_listen_address: String,
|
||||
|
||||
/// Public server hostname (assuming that the ports used are the same for listen address)
|
||||
#[arg(short('H'), long, env, default_value = "localhost")]
|
||||
hostname: String,
|
||||
pub hostname: String,
|
||||
|
||||
/// Server storage path
|
||||
#[arg(short, long, env, default_value = "storage")]
|
||||
@ -106,6 +106,16 @@ impl AppConfig {
|
||||
pub fn devices_ca_priv_key_path(&self) -> PathBuf {
|
||||
self.pki_path().join("devices_ca.key")
|
||||
}
|
||||
|
||||
/// Get PKI server cert path
|
||||
pub fn server_cert_path(&self) -> PathBuf {
|
||||
self.pki_path().join("server.pem")
|
||||
}
|
||||
|
||||
/// Get PKI server private key path
|
||||
pub fn server_priv_key_path(&self) -> PathBuf {
|
||||
self.pki_path().join("server.key")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
Reference in New Issue
Block a user