refactor db connection string
This commit is contained in:
parent
944de6fab0
commit
91e0fed95d
9 changed files with 47 additions and 82 deletions
|
|
@ -1,8 +1,8 @@
|
|||
require('es6-promise').polyfill()
|
||||
|
||||
var fs = require('fs')
|
||||
var notifier = require('../lib/notifier')
|
||||
var db = require('../lib/postgresql_interface')
|
||||
var psqlUrl = require('../lib/options').postgres
|
||||
|
||||
function getBalances () {
|
||||
return [
|
||||
|
|
@ -11,13 +11,6 @@ function getBalances () {
|
|||
]
|
||||
}
|
||||
|
||||
var psqlUrl
|
||||
try {
|
||||
psqlUrl = process.env.DATABASE_URL || JSON.parse(fs.readFileSync('/etc/lamassu.json')).postgresql
|
||||
} catch (ex) {
|
||||
psqlUrl = 'psql://lamassu:lamassu@localhost/lamassu'
|
||||
}
|
||||
|
||||
db.init(psqlUrl)
|
||||
notifier.init(db, getBalances, {lowBalanceThreshold: 10})
|
||||
console.log('DEBUG0')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue