options to open rpc server

remixd
yann300 7 years ago
parent 8c8f8e3670
commit 2bb8af15fe
  1. 4
      src/main.js
  2. 19
      src/services/startMistGeth.js

@ -15,6 +15,8 @@ program
.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('-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)
console.log('example: --dev-path /home/devchains/chain1 --mist --geth --frontend /home/frontend --frontend-port 8084 --auto-mine')
program.outputHelp()
@ -23,7 +25,7 @@ var killCallBack = []
if (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 {
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')
var net = require('net')
var connectTimeout
module.exports = function (dataDir, mist, geth, mine) {
console.log(mist)
console.log(geth)
module.exports = function (dataDir, mist, geth, mine, rpc, rpcPort) {
console.log('opening dev env at ' + dataDir)
// geth --vmdebug --dev --ipcpath /home/yann/Ethereum/testchains/test2/geth.ipc --datadir /home/yann/Ethereum/testchains/test2
var gethprocess
@ -19,7 +17,20 @@ module.exports = function (dataDir, mist, geth, mine) {
'--ipcpath', ipcPath,
'--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)
connectTimeout = setInterval(() => {

Loading…
Cancel
Save