Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly setup the default config for iroh-one #256

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions iroh-one/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ use config::{ConfigError, Map, Source, Value};
use iroh_metrics::config::Config as MetricsConfig;
use iroh_p2p::Libp2pConfig;
use iroh_rpc_client::Config as RpcClientConfig;
#[cfg(feature = "uds-gateway")]
use iroh_rpc_types::Addr;
use iroh_util::insert_into_config_map;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[cfg(feature = "uds-gateway")]
use tempdir::TempDir;

/// CONFIG_FILE_NAME is the name of the optional config file located in the iroh home directory
Expand Down Expand Up @@ -64,14 +62,10 @@ impl Config {
/// The gateway itself is exposing a UDS rpc endpoint to be also usable
/// as a single entry point for other system services if feature enabled.
pub fn default_rpc_config() -> RpcClientConfig {
#[cfg(feature = "uds-gateway")]
let path: PathBuf = TempDir::new("iroh").unwrap().path().join("ipfsd.http");

RpcClientConfig {
#[cfg(feature = "uds-gateway")]
gateway_addr: Some(Addr::GrpcUds(path)),
#[cfg(not(feature = "uds-gateway"))]
gateway_addr: None,
p2p_addr: None,
store_addr: None,
}
Expand All @@ -95,7 +89,7 @@ impl Default for Config {
let rpc_client = Self::default_rpc_config();
let metrics_config = MetricsConfig::default();
let store_config = default_store_config(rpc_client.clone(), metrics_config.clone());
let key_store_path = store_config.path.clone();
let key_store_path = iroh_util::iroh_data_root().unwrap();
Self {
rpc_client: rpc_client.clone(),
metrics: metrics_config.clone(),
Expand Down