Allow passwords on multiple lines in --password files.
This commit is contained in:
parent
8805d04183
commit
156a2336de
@ -39,6 +39,7 @@ extern crate rpassword;
|
|||||||
#[cfg(feature = "rpc")]
|
#[cfg(feature = "rpc")]
|
||||||
extern crate ethcore_rpc as rpc;
|
extern crate ethcore_rpc as rpc;
|
||||||
|
|
||||||
|
use std::io::{BufRead, BufReader};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::net::{SocketAddr, IpAddr};
|
use std::net::{SocketAddr, IpAddr};
|
||||||
use std::env;
|
use std::env;
|
||||||
@ -500,10 +501,12 @@ impl Configuration {
|
|||||||
|
|
||||||
fn account_service(&self) -> AccountService {
|
fn account_service(&self) -> AccountService {
|
||||||
// Secret Store
|
// Secret Store
|
||||||
let passwords = self.args.flag_password.iter().map(|filename| {
|
let passwords = self.args.flag_password.iter().flat_map(|filename| {
|
||||||
let mut buffer = String::new();
|
BufReader::new(&File::open(filename).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename)))
|
||||||
File::open(filename).and_then(|mut f| f.read_to_string(&mut buffer)).unwrap_or_else(|_| die!("{} Unable to read password file. Ensure it exists and permissions are correct.", filename));
|
.lines()
|
||||||
buffer
|
.map(|l| l.unwrap())
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.into_iter()
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
|
||||||
let account_service = AccountService::new();
|
let account_service = AccountService::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user