Skip to content

Commit

Permalink
Merge pull request #1811 from strapi/fix/srv
Browse files Browse the repository at this point in the history
Fix srv
  • Loading branch information
lauriejim committed Aug 27, 2018
2 parents 9e63da5 + 0ac7c13 commit 8983521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/strapi-generate-new/lib/before.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ module.exports = (scope, cb) => {
when: !hasDatabaseConfig && scope.client.database === 'mongo',
type: 'boolean',
name: 'srv',
message: '+srv connection::',
message: '+srv connection:',
default: _.get(scope.database, 'srv', false)
},
{
when: !hasDatabaseConfig,
type: 'input',
name: 'port',
message: 'Port(It will be ignored if you enable +srv):',
message: 'Port (It will be ignored if you enable +srv):',
default: (answers) => { // eslint-disable-line no-unused-vars
if (_.get(scope.database, 'port')) {
return scope.database.port;
Expand Down Expand Up @@ -259,7 +259,7 @@ module.exports = (scope, cb) => {
require(path.join(`${scope.tmpPath}`, '/node_modules/', `${scope.client.connector}/lib/utils/connectivity.js`))(scope, cb.success, connectionValidation);
} catch(err) {
shell.rm('-r', scope.tmpPath);
console.log(err)
console.log(err);
cb.success();
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/strapi-hook-mongoose/lib/utils/connectivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (scope, success, error) => {
connectOptions.useNewUrlParser = true;
connectOptions.dbName = scope.database.settings.database;

Mongoose.connect(`mongodb${srv ? "+srv" : ""}://${scope.database.settings.host}:${!srv ? ":" + scope.database.settings.port : ""}/`, connectOptions, function (err) {
Mongoose.connect(`mongodb${srv ? '+srv' : ''}://${scope.database.settings.host}${!srv ? `:${scope.database.settings.port}` : ''}/`, connectOptions, function (err) {
if (err) {
console.log('鈿狅笍 Database connection has failed! Make sure your database is running.');
return error();
Expand Down

0 comments on commit 8983521

Please sign in to comment.