@4everlink/cli
Version:
command line tool for upload file or directory use the IPFS Cluster HTTP API.
26 lines (25 loc) • 755 B
JavaScript
function parseHost() {
const configDir = process.env.IPFS_CLUSTER_CLIENT_CONF || process.env.HOME + "/.4everlink"
const fs = require('fs')
try{
const path = require('path')
const fileDir = path.resolve(configDir)
const fileConfigPath = fileDir + "/conf.yaml"
const stats = fs.statSync(fileConfigPath)
if(stats.isFile) {
const confContent = fs.readFileSync(fileConfigPath, 'utf-8')
const YAML = require('yaml')
const host = YAML.parse(confContent)
return host
}
}catch(e) {
//console.log(e)
}
return {
host: '127.0.0.1',
port: '9094',
token: '',
}
}
exports = module.exports = parseHost