-
Notifications
You must be signed in to change notification settings - Fork 4
/
db-config.js
50 lines (42 loc) · 1.45 KB
/
db-config.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var dbs = {
databases: {
woodbridge: {
dbURL: {
adapter: 'sqlite3',
database: 'db/woodbridge/woodbridge.db'
},
params: {
title: 'Woodbridge Family Tree',
owner: 'Stephen Woodbridge',
email: 'stephenwoodbridge37 (at) gmail (dot) com',
copyright: "Family Data Copyright 2001-2018 by Stephen Woodbridge, All Rights Reservered.",
hasPhotos: true
}
},
woodbridge_record: {
dbURL: {
adapter: 'sqlite3',
database: 'db/woodbridge_record/woodbridge_record.db'
},
params: {
title: 'Woodbridge Record Book',
owner: 'Stephen Woodbridge',
email: 'stephenwoodbridge37 (at) gmail (dot) com',
copyright: "Family Data Copyright 2001-2018 by Stephen Woodbridge, All Rights Reservered.",
hasPhotos: false
}
}
},
createConnection: function (dbName) {
var dbURL = dbs.databases[dbName]['dbURL'];
if (typeof dbURL === 'undefined') {
console.error("Database '" + dbName + "' is not configured!");
return null;
}
var anyDB = require('any-db');
var pool = anyDB.createPool(dbURL);
pool['adapter'] = dbURL.adapter;
return pool;
}
};
module.exports = dbs;