Merge pull request #677 from ethcore/personal-rpc-cli

Making personal json-rpc configurable via cli
This commit is contained in:
Marek Kotewicz 2016-03-11 20:52:58 +01:00
commit 9e23a0c240
2 changed files with 8 additions and 6 deletions

View File

@ -104,7 +104,8 @@ API and Console Options:
--jsonrpc-port PORT Specify the port portion of the JSONRPC API server [default: 8545].
--jsonrpc-cors URL Specify CORS header for JSON-RPC API responses [default: null].
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC interface. APIS is a comma-delimited
list of API name. Possible names are web3, eth and net. [default: web3,eth,net].
list of API name. Possible name are web3, eth and net. [default: web3,eth,net,personal].
--rpc Equivalent to --jsonrpc (geth-compatible).
--rpcaddr HOST Equivalent to --jsonrpc-addr HOST (geth-compatible).
--rpcport PORT Equivalent to --jsonrpc-port PORT (geth-compatible).
@ -231,6 +232,7 @@ fn setup_rpc_server(client: Arc<Client>, sync: Arc<EthSync>, secret_store: Arc<A
server.add_delegate(EthClient::new(&client, &sync, &secret_store).to_delegate());
server.add_delegate(EthFilterClient::new(&client).to_delegate());
}
"personal" => server.add_delegate(PersonalClient::new(&secret_store).to_delegate()),
_ => {
die!("{}: Invalid API name to be enabled.", api);
}

View File

@ -22,20 +22,20 @@ use util::keys::store::*;
use util::Address;
/// Account management (personal) rpc implementation.
pub struct PersonalClient {
accounts: Weak<AccountProvider>,
pub struct PersonalClient<A> where A: AccountProvider {
accounts: Weak<A>,
}
impl PersonalClient {
impl<A> PersonalClient<A> where A: AccountProvider {
/// Creates new PersonalClient
pub fn new(store: &Arc<AccountProvider>) -> Self {
pub fn new(store: &Arc<A>) -> Self {
PersonalClient {
accounts: Arc::downgrade(store),
}
}
}
impl Personal for PersonalClient {
impl<A> Personal for PersonalClient<A> where A: AccountProvider + 'static {
fn accounts(&self, _: Params) -> Result<Value, Error> {
let store = take_weak!(self.accounts);
match store.accounts() {