lots of notifier improvements
This commit is contained in:
parent
8a87c7579d
commit
8a4b447db3
7 changed files with 172 additions and 26 deletions
30
dev/notify.js
Normal file
30
dev/notify.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
require('es6-promise').polyfill()
|
||||
|
||||
var notifier = require('../lib/notifier')
|
||||
var db = require('../lib/postgresql_interface')
|
||||
|
||||
function getBalances () {
|
||||
return [
|
||||
{fiatBalance: 23.2345, fiatCode: 'USD', cryptoCode: 'BTC'},
|
||||
{fiatBalance: 22, fiatCode: 'USD', cryptoCode: 'ETH'}
|
||||
]
|
||||
}
|
||||
|
||||
db.init('psql://lamassu:lamassu@localhost/lamassu')
|
||||
notifier.init(db, getBalances)
|
||||
console.log('DEBUG0')
|
||||
notifier.checkStatus()
|
||||
.then(function (alertRec) {
|
||||
console.log('DEBUG1')
|
||||
console.log('%j', alertRec)
|
||||
var subject = notifier.alertSubject(alertRec)
|
||||
console.log(subject)
|
||||
var body = notifier.printEmailAlerts(alertRec)
|
||||
console.log(body)
|
||||
console.log(notifier.alertFingerprint(alertRec))
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.log(err.stack)
|
||||
process.exit(1)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue