stress testing; add mock-ticker

This commit is contained in:
Josh Harvey 2017-07-18 08:12:01 +03:00
parent ad66fe1b43
commit 272405b4b1
5 changed files with 30 additions and 9 deletions

View file

@ -4,21 +4,27 @@ const os = require('os')
const _ = require('lodash/fp')
const argv = require('minimist')(process.argv.slice(2))
let serverConfig
function load () {
if (argv.f) {
const configPath = argv.f
return JSON.parse(fs.readFileSync(configPath))
}
try {
const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json')
serverConfig = JSON.parse(fs.readFileSync(globalConfigPath))
} catch (_) {
try {
const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json')
serverConfig = JSON.parse(fs.readFileSync(homeConfigPath))
const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json')
return JSON.parse(fs.readFileSync(globalConfigPath))
} catch (_) {
console.error("Couldn't open lamassu.json config file.")
process.exit(1)
try {
const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json')
return JSON.parse(fs.readFileSync(homeConfigPath))
} catch (_) {
console.error("Couldn't open lamassu.json config file.")
process.exit(1)
}
}
}
const serverConfig = load()
const defaults = {logLevel: 'info'}
const commandLine = {logLevel: argv.logLevel}