Skip to content
Permalink
Browse files

Updated version number to 1.1.9.

Added support for MongoDB's Seedlist Connection Format (resolves #20).
Replaced shrinkwrap file with package-lock.
  • Loading branch information...
nero120 committed Jan 23, 2019
1 parent 1ab37a6 commit 104c795b6683497040faaecfbc8d50a4ae65c6cf
Showing with 53 additions and 37 deletions.
  1. +1 −0 README.md
  2. +1 −0 config/settings.default.json
  3. +8 −1 dist/core/db.js
  4. +1 −1 dist/core/db.js.map
  5. +33 −33 npm-shrinkwrap.json → package-lock.json
  6. +1 −1 package.json
  7. +8 −1 src/core/db.ts
@@ -109,6 +109,7 @@ Config Setting | Description | Default Value
`db.connTimeout` | The connection timeout period to use for MongoDB. Using a high value helps prevent dropped connections in a hosted environment. | `30000` (30 secs)
`db.host` | The MongoDB server address to connect to, either a hostname, IP address, or UNIX domain socket. | `127.0.0.1`
`db.name` | Name of the MongoDB database to use. | `xbrowsersync`
`db.useSRV` | Use MongoDB's [DNS Seedlist Connection Format](https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format) to connect to the database. If set to true, `db.host` should also be set to the relevant DNS hostname. | `false`
`db.username` | Username of the account used to access MongoDB. Set as empty string to use environment variable `XBROWSERSYNC_DB_USER`. | (Empty string, defers to environment variable)
`db.password` | Password of the account used to access MongoDB. Set as empty string to use environment variable `XBROWSERSYNC_DB_PWD`. | (Empty string, defers to environment variable)
`db.port` | The port to use to connect to MongoDB. | `27017`
@@ -6,6 +6,7 @@
"connTimeout": 30000,
"host": "127.0.0.1",
"name": "xbrowsersync",
"useSRV" : false,
"username": "",
"password": "",
"port": 27017

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -1,7 +1,7 @@
{
"name": "xbrowsersync-api",
"description": "The REST API service component of the xBrowserSync application.",
"version": "1.1.8",
"version": "1.1.9",
"author": "xBrowserSync",
"license": "MIT",
"main": "dist/api.js",
@@ -50,7 +50,14 @@ export default class DB {
const password = Config.get().db.password || process.env.XBROWSERSYNC_DB_PWD;

// Connect to the host and db name defined in config settings
const dbServerUrl = `mongodb://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${Config.get().db.host}:${Config.get().db.port}/${Config.get().db.name}?authSource=${Config.get().db.authSource}`;
let dbServerUrl = 'mongodb';
if (Config.get().db.useSRV) {
dbServerUrl += `+srv://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${Config.get().db.host}/${Config.get().db.name}`;
dbServerUrl += (Config.get().db.authSource) ? `?authSource=${Config.get().db.authSource}` : '';
}
else {
dbServerUrl += `://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${Config.get().db.host}:${Config.get().db.port}/${Config.get().db.name}?authSource=${Config.get().db.authSource}`;
}
mongoose.connect(dbServerUrl, options);
const dbConn = mongoose.connection;

0 comments on commit 104c795

Please sign in to comment.
You can’t perform that action at this time.