From 6f5515214a07951e49a8538dc850871a408c7849 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Wed, 18 Mar 2020 19:17:08 +0100 Subject: [PATCH 1/2] update mongoose options --- config.json.example | 4 ++-- website/server/libs/setupMongoose.js | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config.json.example b/config.json.example index 32ba8cf1a1..306e1bb24e 100644 --- a/config.json.example +++ b/config.json.example @@ -32,7 +32,7 @@ "LOGGLY_SUBDOMAIN": "example-subdomain", "LOGGLY_TOKEN": "example-token", "MAINTENANCE_MODE": "false", - "NODE_DB_URI": "mongodb://localhost/habitrpg", + "NODE_DB_URI": "mongodb://localhost:27017/habitrpg", "MONGODB_POOL_SIZE": "10", "NODE_ENV": "development", "PATH": "bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin", @@ -70,7 +70,7 @@ "SLACK_URL": "https://hooks.slack.com/services/some-url", "STRIPE_API_KEY": "aaaabbbbccccddddeeeeffff00001111", "STRIPE_PUB_KEY": "22223333444455556666777788889999", - "TEST_DB_URI": "mongodb://localhost/habitrpg_test", + "TEST_DB_URI": "mongodb://localhost:27017/habitrpg_test", "TRANSIFEX_SLACK_CHANNEL": "transifex", "WEB_CONCURRENCY": 1, "SKIP_SSL_CHECK_KEY": "key", diff --git a/website/server/libs/setupMongoose.js b/website/server/libs/setupMongoose.js index db7610426e..91eae637f9 100644 --- a/website/server/libs/setupMongoose.js +++ b/website/server/libs/setupMongoose.js @@ -8,9 +8,15 @@ const POOL_SIZE = nconf.get('MONGODB_POOL_SIZE'); // Do not connect to MongoDB when in maintenance mode if (MAINTENANCE_MODE !== 'true') { - const mongooseOptions = !IS_PROD ? {} : { + const commonOptions = { + useNewUrlParser: true, + useUnifiedTopology: true, + }; + + const mongooseOptions = !IS_PROD ? commonOptions : { keepAlive: 120, connectTimeoutMS: 30000, + ...commonOptions, }; if (POOL_SIZE) mongooseOptions.poolSize = Number(POOL_SIZE); From 289032047c461f9f1d036a10f5d2f693fc106ae9 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Wed, 18 Mar 2020 19:39:37 +0100 Subject: [PATCH 2/2] 4.137.1 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f4469df58..e4843a4fa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "habitica", - "version": "4.137.0", + "version": "4.137.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e3b2af1493..dff1d1db6c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "habitica", "description": "A habit tracker app which treats your goals like a Role Playing Game.", - "version": "4.137.0", + "version": "4.137.1", "main": "./website/server/index.js", "dependencies": { "@babel/core": "^7.8.7",