-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd-seed-config.js
35 lines (29 loc) · 943 Bytes
/
md-seed-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import mongooseLib from 'mongoose';
mongooseLib.Promise = global.Promise;
import Areas from './seeders/areas.seeder';
import Characters from './seeders/characters.seeder';
import Rooms from './seeders/rooms.seeder';
import Shops from './seeders/shops.seeder';
import Users from './seeders/users.seeder';
import Worlds from './seeders/worlds.seeder';
// Export the mongoose lib
export const mongoose = mongooseLib;
// Export the mongodb url
export const mongoURL = process.env.MONGO_DB && process.env.MONGO_PORT
? `mongodb://localhost:${process.env.MONGO_PORT}/${process.env.MONGO_DB}`
: 'mongodb://localhost:27017/mud';
/*
Seeders List
------
order is important
*/
export const seedersList = {
Areas,
Characters,
Rooms,
//Shops,
Users,
Worlds,
};
export const connect = async () => await mongoose.connect(mongoURL, { useNewUrlParser: true });
export const dropdb = async () => mongoose.connection.db.dropDatabase();