-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
26 lines (19 loc) · 925 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = (plugin, config) => {
config = config || {}
plugin = (plugin || '').toLowerCase()
if (!plugin) {
plugin = 'local'
console.warn('Database Notice: No plugin name supplied. Defaulting to local. Docs: https://github.com/fwd/database')
}
try {
if (plugin === 'lowdb') return require('./plugins/lowdb')(config)
if (plugin === 'local') return require('./plugins/local')(config)
// if (plugin === 'mongodb') return require('./plugins/mongodb')(config)
// if (plugin === 'mariadb') return require('./plugins/mariadb')(config)
// if (plugin === 'mysql') return require('./plugins/mysql')(config)
if (plugin === 'sqlite3' || plugin === 'sqlite') return require('./plugins/sqlite3')(config)
return console.error(`Database Error: Plugin '${plugin}' not supported yet. Create issue on Github: https://github.com/fwd/database/issues`)
} catch (e) {
console.log("Database Error:", e)
}
}