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

wallet/owner_api: allow owner API port to be configurable #2475

Merged
merged 1 commit into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
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
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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to your changes but shouldn't this be ChainTypes::Mainnet?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it should, yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed in #2478

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