budibase/packages/server/db/client.js

15 lines
358 B
JavaScript
Raw Normal View History

const PouchDB = require("pouchdb")
2020-04-25 09:35:34 +02:00
const allDbs = require("pouchdb-all-dbs")
2020-04-07 16:12:08 +02:00
2020-04-24 18:28:32 +02:00
module.exports = () => {
const COUCH_DB_URL =
process.env.COUCH_DB_URL || "http://admin:password@localhost:5984"
const DATABASE_TYPE = process.env.DATABASE_TYPE || "couch"
2020-04-07 16:12:08 +02:00
2020-04-26 22:13:14 +02:00
const pouch = PouchDB.defaults({
2020-04-24 18:28:32 +02:00
prefix: COUCH_DB_URL,
})
2020-04-25 09:35:34 +02:00
allDbs(pouch)
return pouch
2020-04-24 18:28:32 +02:00
}