Skip to content

Commit

Permalink
put webrtc certificate within base, not network config directory
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Nov 22, 2022
1 parent 43ed99e commit 0f49005
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
///
/// By default this is retrieved from [`WebRTCCertificateParams`] if it is available. Otherwise
/// its [`WebRTCConfig::Ephemeral`].
fn webrtc(&self, net_config_dir: &PathBuf) -> Result<WebRTCConfig> {
fn webrtc(&self, config_dir: &PathBuf) -> Result<WebRTCConfig> {
self.webrtc_certificate_params()
.map(|x| x.webrtc_certificate(net_config_dir))
.map(|x| x.webrtc_certificate(config_dir))
.unwrap_or_else(|| Ok(WebRTCConfig::Ephemeral))
}

Expand Down Expand Up @@ -520,7 +520,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
},
);
let node_key = self.node_key(&net_config_dir)?;
let webrtc = self.webrtc(&net_config_dir)?;
let webrtc = self.webrtc(&config_dir)?;
let role = self.role(is_dev)?;
let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8);
let is_validator = role.is_authority();
Expand Down
8 changes: 4 additions & 4 deletions client/cli/src/params/webrtc_certificate_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct WebRTCCertificateParams {
/// The contents of the file are parsed as follows:
///
/// The file must contain an ASCII PEM encoded
/// [`webrtc::peer_connection::certificate::RTCCertificate`].
/// [`webrtc::peer_connection::certificate::RTCCertificate`].
///
/// If the file does not exist, it is created with a newly generated certificate.
#[clap(long, value_name = "FILE")]
Expand All @@ -53,16 +53,16 @@ pub struct WebRTCCertificateParams {

impl WebRTCCertificateParams {
/// Create a `WebRTCConfig` from the given `WebRTCCertificateParams` in the context
/// of an optional network config storage directory.
pub fn webrtc_certificate(&self, net_config_dir: &PathBuf) -> error::Result<WebRTCConfig> {
/// of an optional base config storage directory.
pub fn webrtc_certificate(&self, config_dir: &PathBuf) -> error::Result<WebRTCConfig> {
if let Some(true) = self.webrtc_certificate_ephemeral {
return Ok(WebRTCConfig::Ephemeral)
}

let filename = self
.webrtc_certificate_file
.clone()
.unwrap_or_else(|| net_config_dir.join(WEBRTC_CERTIFICATE_FILENAME));
.unwrap_or_else(|| config_dir.join(WEBRTC_CERTIFICATE_FILENAME));

Ok(WebRTCConfig::File(filename))
}
Expand Down

0 comments on commit 0f49005

Please sign in to comment.