Skip to content

Commit

Permalink
wallet/owner_api: allow owner API port to be configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
RaghavSood committed Jan 27, 2019
1 parent 92cbfa2 commit fecf524
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions wallet/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use uuid::Uuid;

use crate::api::TLSConfig;
use crate::core::core;
use crate::core::global;
use crate::keychain;

use crate::error::{Error, ErrorKind};
Expand Down Expand Up @@ -146,7 +145,7 @@ pub fn owner_api(
) -> Result<(), Error> {
let res = controller::owner_listener(
wallet,
&format!("127.0.0.1:{}", (if global::is_floonet() { "13420" } else { "3420" })),
config.owner_api_listen_addr().as_str(),
g_args.node_api_secret.clone(),
g_args.tls_conf.clone(),
config.owner_api_include_foreign.clone(),
Expand Down
7 changes: 7 additions & 0 deletions wallet/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pub struct WalletConfig {
pub api_listen_interface: String,
// The port this wallet will run on
pub api_listen_port: u16,
// The port this wallet's owner API will run on
pub owner_api_listen_port: u16,
/// Location of the secret for basic auth on the Owner API
pub api_secret_path: Option<String>,
/// Location of the node api secret for basic auth on the Grin API
Expand Down Expand Up @@ -72,6 +74,7 @@ impl Default for WalletConfig {
chain_type: Some(ChainTypes::Floonet),
api_listen_interface: "127.0.0.1".to_string(),
api_listen_port: 3415,
owner_api_listen_port: 3420,
api_secret_path: Some(".api_secret".to_string()),
node_api_secret_path: Some(".api_secret".to_string()),
check_node_api_http_addr: "http://127.0.0.1:3413".to_string(),
Expand All @@ -90,6 +93,10 @@ impl WalletConfig {
pub fn api_listen_addr(&self) -> String {
format!("{}:{}", self.api_listen_interface, self.api_listen_port)
}

pub fn owner_api_listen_addr(&self) -> String {
format!("127.0.0.1:{}", self.owner_api_listen_port)
}
}

#[derive(Clone, Debug, PartialEq)]
Expand Down

0 comments on commit fecf524

Please sign in to comment.