Skip to content

Commit 211ab40

Browse files
committed
Upgrage mongodb-migrations to work with mongodb SSL connection
1 parent 384ab31 commit 211ab40

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@ All notable changes to this project will be documented in this file.
33
Adheres to [Semantic Versioning](http://semver.org/).
44

55
---
6-
## 4.4.1 (TBD)
6+
## 4.4.2 (TBD)
77

88
* TBD
99

1010
##### Features
1111

1212
##### Bug Fixes
1313

14+
## [4.4.1](https://github.com/ngageoint/mage-server/releases/tag/v4.4.1) (01-26-2017)
15+
16+
##### Features
17+
18+
##### Bug Fixes
19+
* Fix migrations module to work with mongodb SSL connection
20+
1421
## [4.4.0](https://github.com/ngageoint/mage-server/releases/tag/v4.4.0) (01-11-2017)
1522

1623
#### This release include database migrations.

environment/local/env.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ var serverOptions = {
3737
// http://mongodb.github.io/node-mongodb-native/2.0/tutorials/enterprise_features/
3838
// You will also need to setup SSL on the mongodb side: https://docs.mongodb.com/v3.0/tutorial/configure-ssl/
3939

40+
// 2-way ssl configuration with x509 certificate
41+
// environment.mongo.options = {
42+
// server: serverOptions,
43+
// user: '',
44+
// auth: {
45+
// authdb: '$external' ,
46+
// authMechanism: 'MONGODB-X509'
47+
// }
48+
// };
49+
4050
// serverOptions.ssl = true;
4151
// serverOptions.sslValidate = false;
4252
// serverOptions.sslCA = fs.readFileSync('/etc/ssl/mongodb-cert.crt');

migrations/mm-config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var environment = require('environment')
22
, mongoose = require('mongoose')
33
, log = require('winston');
44

5+
var mongo = environment.mongo;
6+
57
var migrateConfig = {
68
scheme: environment.mongo.scheme,
79
host: environment.mongo.host,
@@ -10,10 +12,12 @@ var migrateConfig = {
1012
user: environment.mongo.username,
1113
password: environment.mongo.password,
1214
collection: "migrations",
13-
directory: "migrations"
15+
directory: "migrations",
16+
options: environment.mongo.options
1417
};
1518

16-
mongoose.connect(environment.mongo.uri, function(err) {
19+
log.info('using mongodb connection from: ' + mongo.uri);
20+
mongoose.connect(environment.mongo.uri, environment.mongo.options, function(err) {
1721
if (err) {
1822
log.error('Error connecting to mongo database, please make sure mongodbConfig is running...');
1923
throw err;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"jszip": "2.5.0",
3838
"method-override": "1.0.x",
3939
"moment": "2.12.0",
40-
"mongodb-migrations": "0.5.1",
40+
"mongodb-migrations": "0.8.3",
4141
"mongoose": "4.4.4",
4242
"multer": "0.1.x",
4343
"passport": "0.1.x",

0 commit comments

Comments
 (0)