2021-01-14 18:01:31 +01:00
|
|
|
const PouchDB = require("pouchdb")
|
|
|
|
const allDbs = require("pouchdb-all-dbs")
|
|
|
|
const env = require("../environment")
|
|
|
|
const { join } = require("path")
|
|
|
|
const { homedir } = require("os")
|
|
|
|
|
|
|
|
// level option is purely for testing (development)
|
2021-01-14 18:02:05 +01:00
|
|
|
const COUCH_DB_URL =
|
|
|
|
env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/`
|
2021-01-14 18:01:31 +01:00
|
|
|
|
|
|
|
const Pouch = PouchDB.defaults({
|
|
|
|
prefix: COUCH_DB_URL,
|
|
|
|
})
|
|
|
|
|
|
|
|
allDbs(Pouch)
|
|
|
|
|
2021-01-14 18:02:05 +01:00
|
|
|
module.exports = Pouch
|