Fix new_from_env() to populate nym_api_urls for domain fronting
This commit is contained in:
@@ -124,6 +124,8 @@ impl NymNetworkDetails {
|
||||
}
|
||||
}
|
||||
|
||||
let nym_api = var(var_names::NYM_API).expect("nym api not set");
|
||||
|
||||
NymNetworkDetails::new_empty()
|
||||
.with_network_name(var(var_names::NETWORK_NAME).expect("network name not set"))
|
||||
.with_bech32_account_prefix(
|
||||
@@ -149,7 +151,7 @@ impl NymNetworkDetails {
|
||||
})
|
||||
.with_additional_validator_endpoint(ValidatorDetails::new(
|
||||
var(var_names::NYXD).expect("nyxd validator not set"),
|
||||
Some(var(var_names::NYM_API).expect("nym api not set")),
|
||||
Some(nym_api.clone()),
|
||||
get_optional_env(var_names::NYXD_WEBSOCKET),
|
||||
))
|
||||
.with_mixnet_contract(get_optional_env(var_names::MIXNET_CONTRACT_ADDRESS))
|
||||
@@ -159,6 +161,10 @@ impl NymNetworkDetails {
|
||||
.with_multisig_contract(get_optional_env(var_names::MULTISIG_CONTRACT_ADDRESS))
|
||||
.with_coconut_dkg_contract(get_optional_env(var_names::COCONUT_DKG_CONTRACT_ADDRESS))
|
||||
.with_nym_vpn_api_url(get_optional_env(var_names::NYM_VPN_API))
|
||||
.with_nym_api_urls(Some(vec![ApiUrl {
|
||||
url: nym_api,
|
||||
front_hosts: None,
|
||||
}]))
|
||||
}
|
||||
|
||||
pub fn new_mainnet() -> Self {
|
||||
@@ -348,6 +354,12 @@ impl NymNetworkDetails {
|
||||
self
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn with_nym_api_urls(mut self, urls: Option<Vec<ApiUrl>>) -> Self {
|
||||
self.nym_api_urls = urls;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn nym_vpn_api_url(&self) -> Option<Url> {
|
||||
self.nym_vpn_api_url.as_ref().map(|url| {
|
||||
url.parse()
|
||||
|
||||
@@ -226,7 +226,8 @@ mod tests {
|
||||
error!("{err}");
|
||||
// this is not an ideal way of checking it, but if test fails due to networking failures
|
||||
// it should be fine to progress
|
||||
if err.to_string().contains("nym api request failed") {
|
||||
let err_str = err.to_string();
|
||||
if err_str.contains("nym api") || err_str.contains("failed to connect") {
|
||||
return Ok(());
|
||||
}
|
||||
return Err(err);
|
||||
@@ -291,7 +292,8 @@ mod tests {
|
||||
error!("{err}");
|
||||
// this is not an ideal way of checking it, but if test fails due to networking failures
|
||||
// it should be fine to progress
|
||||
if err.to_string().contains("nym api request failed") {
|
||||
let err_str = err.to_string();
|
||||
if err_str.contains("nym api") || err_str.contains("failed to connect") {
|
||||
return Ok(());
|
||||
}
|
||||
return Err(err);
|
||||
|
||||
Reference in New Issue
Block a user