2020-04-24 01:37:08 +12:00
|
|
|
// const nano = require("nano")
|
2020-04-24 20:54:20 +12:00
|
|
|
const PouchDB = require("pouchdb")
|
2020-04-08 02:12:08 +12:00
|
|
|
|
2020-04-09 04:00:27 +12:00
|
|
|
const COUCH_DB_URL =
|
|
|
|
process.env.COUCH_DB_URL || "http://admin:password@localhost:5984"
|
2020-04-08 02:12:08 +12:00
|
|
|
|
2020-04-24 20:54:20 +12:00
|
|
|
// database can be "pouch" or "couch"
|
|
|
|
const CouchDB = ({ database, couchDbConnectionString }) => {
|
|
|
|
database = database || "couch"
|
|
|
|
couchDbConnectionString = couchDbConnectionString || COUCH_DB_URL
|
|
|
|
if (database === "couch") {
|
|
|
|
return PouchDB.defaults({
|
|
|
|
prefix: couchDbConnectionString,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
// else setup for leveldb
|
|
|
|
}
|
2020-04-24 01:37:08 +12:00
|
|
|
|
2020-04-24 20:54:20 +12:00
|
|
|
module.exports = CouchDB
|