mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-23 03:23:48 +01:00
add getDbUrl fund
This commit is contained in:
parent
22bd0b6953
commit
990b364635
@ -14,6 +14,14 @@ export function getLegalDBName(input) {
|
|||||||
.replace(/(%..)/g, esc => `(${esc.substr(1)})`);
|
.replace(/(%..)/g, esc => `(${esc.substr(1)})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDbUrl(db) {
|
||||||
|
if (db.user) {
|
||||||
|
return `${db.protocol}${encodeURIComponent(db.user)}:${encodeURIComponent(db.password)}@${db.host}`;
|
||||||
|
} else {
|
||||||
|
return `${db.protocol}${db.host}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const dbs = {};
|
const dbs = {};
|
||||||
export function getDb(dbUrl) {
|
export function getDb(dbUrl) {
|
||||||
if (!dbs[dbUrl]) dbs[dbUrl] = new PouchDB(dbUrl);
|
if (!dbs[dbUrl]) dbs[dbUrl] = new PouchDB(dbUrl);
|
||||||
|
Loading…
Reference in New Issue
Block a user