Commit 2bb8af15 authored by yann300's avatar yann300

options to open rpc server

parent 8c8f8e36
...@@ -15,6 +15,8 @@ program ...@@ -15,6 +15,8 @@ program
.option('-f, --frontend <front-end>', 'Folder that should be served by remixd') .option('-f, --frontend <front-end>', 'Folder that should be served by remixd')
.option('-p, --frontend-port <front-end-port>', 'Http port used by the frontend (default 8082)') .option('-p, --frontend-port <front-end-port>', 'Http port used by the frontend (default 8082)')
.option('-a, --auto-mine', 'mine pending transactions') .option('-a, --auto-mine', 'mine pending transactions')
.option('-r, --rpc <cors-domains>', 'start rpc server. Values are CORS domain')
.option('-rp, --rpc-port', 'rpc server port (default 8545)')
.parse(process.argv) .parse(process.argv)
console.log('example: --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine') console.log('example: --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine')
program.outputHelp() program.outputHelp()
...@@ -23,7 +25,7 @@ var killCallBack = [] ...@@ -23,7 +25,7 @@ var killCallBack = []
if (program.devPath) { if (program.devPath) {
if (fs.existsSync(program.devPath)) { if (fs.existsSync(program.devPath)) {
killCallBack.push(startmistGeth(program.devPath, program.mist, program.geth, program.autoMine)) killCallBack.push(startmistGeth(program.devPath, program.mist, program.geth, program.autoMine, program.rpc, program.rpcPort))
} else { } else {
console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start mist/geth. ' + program.devPath + ' does not exist') console.log('\x1b[31m%s\x1b[0m', '[ERR] can\'t start mist/geth. ' + program.devPath + ' does not exist')
} }
......
...@@ -5,9 +5,7 @@ var Web3 = require('web3') ...@@ -5,9 +5,7 @@ var Web3 = require('web3')
var net = require('net') var net = require('net')
var connectTimeout var connectTimeout
module.exports = function (dataDir, mist, geth, mine) { module.exports = function (dataDir, mist, geth, mine, rpc, rpcPort) {
console.log(mist)
console.log(geth)
console.log('opening dev env at ' + dataDir) console.log('opening dev env at ' + dataDir)
// geth --vmdebug --dev --ipcpath /home/yann/Ethereum/testchains/test2/geth.ipc --datadir /home/yann/Ethereum/testchains/test2 // geth --vmdebug --dev --ipcpath /home/yann/Ethereum/testchains/test2/geth.ipc --datadir /home/yann/Ethereum/testchains/test2
var gethprocess var gethprocess
...@@ -19,7 +17,20 @@ module.exports = function (dataDir, mist, geth, mine) { ...@@ -19,7 +17,20 @@ module.exports = function (dataDir, mist, geth, mine) {
'--ipcpath', ipcPath, '--ipcpath', ipcPath,
'--datadir', dataDir '--datadir', dataDir
] ]
console.log('starting geth ... ' + ipcPath) if (rpc) {
gethArgs.push('--rpc')
gethArgs.push('--rpccorsdomain')
gethArgs.push(rpc)
gethArgs.push('--rpcapi')
gethArgs.push('web3,eth,debug,net')
if (!rpcPort) {
rpcPort = 8545
}
gethArgs.push('--rpcport')
gethArgs.push(rpcPort)
}
console.log(gethArgs)
console.log('starting geth ... ')
gethprocess = run('geth', gethArgs) gethprocess = run('geth', gethArgs)
connectTimeout = setInterval(() => { connectTimeout = setInterval(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment