add blockchain install scripts

This commit is contained in:
Josh Harvey 2017-07-01 16:02:46 +03:00
parent 0e9e27b97b
commit 178f576cfb
39 changed files with 3938 additions and 750 deletions

View file

@ -23,18 +23,27 @@ function fetch (account, method, params) {
return r.data.result
})
.catch(err => {
console.log(err.response.data.error)
console.log(err.message)
try {
console.log(err.response.data.error)
} catch (__) {}
throw err
})
}
function split (str) {
const i = str.indexOf('=')
if (i === -1) return []
return [str.slice(0, i), str.slice(i + 1)]
}
function parseConf (confPath) {
const conf = fs.readFileSync(confPath)
const lines = conf.toString().split('\n', 2)
const lines = conf.toString().split('\n')
const res = {}
for (let i = 0; i < lines.length; i++) {
const keyVal = lines[i].split('=')
const keyVal = split(lines[i])
// skip when value is empty
if (!keyVal[1]) continue