mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
fix(mongo): start replica set
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable-file */
|
/* eslint-disable-file */
|
||||||
import { MongoMemoryServer } from 'mongodb-memory-server';
|
import { MongoMemoryReplSet } from 'mongodb-memory-server';
|
||||||
|
|
||||||
import { dirname } from 'node:path';
|
import { dirname } from 'node:path';
|
||||||
import { existsSync, mkdirSync } from 'node:fs';
|
import { existsSync, mkdirSync } from 'node:fs';
|
||||||
@@ -22,11 +22,24 @@ if (!existsSync(mongoDbPath)) {
|
|||||||
// async code in where
|
// async code in where
|
||||||
|
|
||||||
// This will create an new instance of "MongoMemoryServer" and automatically start it
|
// This will create an new instance of "MongoMemoryServer" and automatically start it
|
||||||
const mongod = await MongoMemoryServer.create({
|
const mongod = await MongoMemoryReplSet.create({
|
||||||
instance: {
|
replSet: {
|
||||||
port: 27017,
|
count: 3,
|
||||||
|
dbName: TEST_MODE ? 'habitica-test' : 'habitica-dev',
|
||||||
dbPath: mongoDbPath,
|
dbPath: mongoDbPath,
|
||||||
|
name: 'rs',
|
||||||
},
|
},
|
||||||
|
instanceOpts: [
|
||||||
|
{
|
||||||
|
port: 27017,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
port: 27018,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
port: 27019,
|
||||||
|
},
|
||||||
|
],
|
||||||
dispose: {
|
dispose: {
|
||||||
cleanup: !BUILD_MODE && !TEST_MODE,
|
cleanup: !BUILD_MODE && !TEST_MODE,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user