mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-11-12 10:33:54 +01:00
Global config instance (#769)
* config: global instance * fix: cli tests * fix: owner api tests * config: save tor config * fix: owner rpc tests * fix: set config file path on init and owner api call * tor: store launched services, get global config at command loop, remove unused listen args, check for empty global config to set default, do not save empty tor config at owner * api: update config in memory after successful file write * arti: restart proxy in loop * fix: comment for tor config save * config: set or init, update without error * config: scoped tor config * build: update lock file * config: ability to store multiple configurations at memory from config path * tor: restart service on config change * fix: owner api test * foreign: pass tor config from args, stop service, error handling * arti: move runtime wrapper to single file * config: read existing config from file at create_config * config: handle error on read * arti: single dir for cache * foreign: register config listener before launch * config: save temp * config: remove unused error type * config: make path and members not optional, return an error on config creation if it exists, pass default tor config to send if not set * arti: non public runtime wrapper * config: migrate comments * fix: rpc tests * config: return from cache if exists * config: save disabled tor config when null provided at owner and tor section was not set * config: update tor with args at listener * config: pass pathbuf directly on creation * config: unique tmp file name, setting permissions and providing config version * fix global config handling * fix config persistence * fix tor service restart * fix config synchronization * require wallet close before changing data directory * unify global config updates --------- Co-authored-by: wiesche <wiesche89@googlemail.com>
This commit is contained in:
+9
-5
@@ -19,7 +19,8 @@ use clap::App;
|
||||
//use colored::Colorize;
|
||||
use grin_keychain as keychain;
|
||||
use grin_wallet_api::Owner;
|
||||
use grin_wallet_config::{TorConfig, WalletConfig};
|
||||
use grin_wallet_config::config::get_global_config;
|
||||
use grin_wallet_config::GlobalWalletConfig;
|
||||
use grin_wallet_controller::command::GlobalArgs;
|
||||
use grin_wallet_controller::Error;
|
||||
use grin_wallet_impls::DefaultWalletImpl;
|
||||
@@ -107,10 +108,9 @@ pub fn start_updater_thread(rx: Receiver<StatusMessage>) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
pub fn command_loop<L, C, K>(
|
||||
config: GlobalWalletConfig,
|
||||
wallet_inst: Arc<Mutex<Box<dyn WalletInst<'static, L, C, K>>>>,
|
||||
keychain_mask: Option<SecretKey>,
|
||||
wallet_config: &WalletConfig,
|
||||
tor_config: &TorConfig,
|
||||
global_wallet_args: &GlobalArgs,
|
||||
test_mode: bool,
|
||||
) -> Result<(), Error>
|
||||
@@ -151,7 +151,7 @@ where
|
||||
|
||||
// catch updater messages
|
||||
let (tx, rx) = channel();
|
||||
let mut owner_api = Owner::new(wallet_inst, Some(tx));
|
||||
let mut owner_api = Owner::new(wallet_inst, Some(tx), config.config_file_path.clone());
|
||||
start_updater_thread(rx)?;
|
||||
|
||||
// start the automatic updater
|
||||
@@ -218,11 +218,15 @@ where
|
||||
}
|
||||
_ => keychain_mask,
|
||||
};
|
||||
let config = get_global_config(&config.config_file_path)
|
||||
.map_err(|e| Error::GenericError(e.to_string()))?;
|
||||
let tor_config = config.tor_config();
|
||||
let wallet_config = config.members.wallet;
|
||||
match wallet_args::parse_and_execute(
|
||||
&mut owner_api,
|
||||
keychain_mask.clone(),
|
||||
&wallet_config,
|
||||
&tor_config,
|
||||
tor_config,
|
||||
&global_wallet_args,
|
||||
&args,
|
||||
test_mode,
|
||||
|
||||
Reference in New Issue
Block a user