update to latest lamassu.json

This commit is contained in:
Josh Harvey 2016-11-06 16:04:27 +00:00
parent e559548b04
commit 478c6ebe0c
3 changed files with 13 additions and 19 deletions

View file

@ -1,24 +1,20 @@
'use strict'
const fs = require('fs')
const path = require('path')
const os = require('os')
var fs = require('fs')
var path = require('path')
var os = require('os')
var options
var configPath
let serverConfig
try {
configPath = '/etc/lamassu.json'
options = JSON.parse(fs.readFileSync(configPath))
} catch (err) {
const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json')
serverConfig = JSON.parse(fs.readFileSync(homeConfigPath))
} catch (_) {
try {
configPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json')
console.log(configPath)
options = JSON.parse(fs.readFileSync(configPath))
} catch (err2) {
console.log('Missing configuration file -- exiting.')
const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json')
serverConfig = JSON.parse(fs.readFileSync(globalConfigPath))
} catch (_) {
console.log("Couldn't open config file.")
process.exit(1)
}
}
module.exports = options
module.exports = serverConfig