mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Re-introduce wallet config as part of global grin.toml
Wallet configuration was disabled presumably as wallet is its own separate process. However people seem to still want to use a single config for everything, which may be a sign that the lifecycle of the wallet and the server should be the same by default (with appropriate options to only start one). Note that this does *not* mean that the wallet and the server should share the same process. The wallet process can easily be forked. But sharing the same config file may provide a lot of future convenience.
This commit is contained in:
parent
1ac8aa9978
commit
f001006fc9
3 changed files with 13 additions and 9 deletions
|
@ -24,6 +24,7 @@ use grin::ServerConfig;
|
||||||
use pow::types::MinerConfig;
|
use pow::types::MinerConfig;
|
||||||
use util::LoggingConfig;
|
use util::LoggingConfig;
|
||||||
use types::{ConfigError, ConfigMembers, GlobalConfig};
|
use types::{ConfigError, ConfigMembers, GlobalConfig};
|
||||||
|
use wallet::WalletConfig;
|
||||||
|
|
||||||
/// The default file name to use when trying to derive
|
/// The default file name to use when trying to derive
|
||||||
/// the config file location
|
/// the config file location
|
||||||
|
@ -39,6 +40,7 @@ impl Default for ConfigMembers {
|
||||||
server: ServerConfig::default(),
|
server: ServerConfig::default(),
|
||||||
mining: Some(MinerConfig::default()),
|
mining: Some(MinerConfig::default()),
|
||||||
logging: Some(LoggingConfig::default()),
|
logging: Some(LoggingConfig::default()),
|
||||||
|
wallet: WalletConfig::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ use std::fmt;
|
||||||
use grin::ServerConfig;
|
use grin::ServerConfig;
|
||||||
use pow::types::MinerConfig;
|
use pow::types::MinerConfig;
|
||||||
use util::LoggingConfig;
|
use util::LoggingConfig;
|
||||||
|
use wallet::WalletConfig;
|
||||||
|
|
||||||
/// Error type wrapping config errors.
|
/// Error type wrapping config errors.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -101,9 +102,9 @@ pub struct ConfigMembers {
|
||||||
/// Logging config
|
/// Logging config
|
||||||
pub logging: Option<LoggingConfig>,
|
pub logging: Option<LoggingConfig>,
|
||||||
|
|
||||||
//removing wallet from here for now,
|
/// Wallet config. May eventually need to be moved to its own thing. Or not.
|
||||||
//as its concerns are separate from the server's, really
|
/// Depends on whether we end up starting the wallet in its own process but
|
||||||
//given it needs to manage keys. It should probably
|
/// with the same lifecycle as the server.
|
||||||
//stay command line only for the time being
|
#[serde(default)]
|
||||||
//pub wallet: Option<WalletConfig>
|
pub wallet: WalletConfig,
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ fn main() {
|
||||||
|
|
||||||
// client commands and options
|
// client commands and options
|
||||||
("wallet", Some(wallet_args)) => {
|
("wallet", Some(wallet_args)) => {
|
||||||
wallet_command(wallet_args);
|
wallet_command(wallet_args, global_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If nothing is specified, try to just use the config file instead
|
// If nothing is specified, try to just use the config file instead
|
||||||
|
@ -368,8 +368,9 @@ fn server_command(server_args: &ArgMatches, global_config: GlobalConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wallet_command(wallet_args: &ArgMatches) {
|
fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
|
||||||
let mut wallet_config = WalletConfig::default();
|
// just get defaults from the global config
|
||||||
|
let mut wallet_config = global_config.members.unwrap().wallet;
|
||||||
|
|
||||||
if let Some(port) = wallet_args.value_of("port") {
|
if let Some(port) = wallet_args.value_of("port") {
|
||||||
wallet_config.api_listen_port = port.to_string();
|
wallet_config.api_listen_port = port.to_string();
|
||||||
|
|
Loading…
Reference in a new issue