update ssu, email and sms
This commit is contained in:
parent
e42bde7b63
commit
7e15308499
5 changed files with 117 additions and 53 deletions
24
lib/config.js
Normal file
24
lib/config.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
require('es6-promise').polyfill()
|
||||
var fs = require('fs')
|
||||
var pgp = require('pg-promise')()
|
||||
|
||||
function connect () {
|
||||
var psqlUrl
|
||||
try {
|
||||
psqlUrl = process.env.DATABASE_URL || JSON.parse(fs.readFileSync('/etc/lamassu.json')).postgresql
|
||||
} catch (ex) {
|
||||
psqlUrl = 'psql://lamassu:lamassu@localhost/lamassu'
|
||||
}
|
||||
return pgp(psqlUrl)
|
||||
}
|
||||
|
||||
function loadConfig () {
|
||||
var db = connect()
|
||||
return db.one('select data from user_config where type=$1', 'exchanges')
|
||||
.then(function (data) {
|
||||
pgp.end()
|
||||
return data.data
|
||||
})
|
||||
}
|
||||
|
||||
exports.loadConfig = loadConfig
|
||||
Loading…
Add table
Add a link
Reference in a new issue