const firebird = require('./firebird')

const options = {
  host: process.env.FIREBIRD_HOST,
  port: process.env.FIREBIRD_PORT,
  user: process.env.FIREBIRD_USER,
  password: process.env.FIREBIRD_PASS,
  database: process.env.FIREBIRD_BASE
}

module.exports = new Promise((resolve, reject) => {
  firebird.attach(options, (err, db) => {
    if (err) {
      reject(err)
    }

    resolve(db)
  })
})
