-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.js
48 lines (37 loc) · 1.57 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
var dotenv = require('dotenv');
var Food = require('./app/model.food.js');
var User = require('./app/model.user.js');
module.exports = function() {
switch (process.env.NODE_ENV) {
case 'development':
dotenv._getKeysAndValuesFromEnvFilePath('.env.development');
break;
case 'production':
dotenv._getKeysAndValuesFromEnvFilePath('.env.production');
break;
case 'example':
dotenv._getKeysAndValuesFromEnvFilePath('.env.example');
break;
default:
dotenv._getKeysAndValuesFromEnvFilePath('.env.example');
}
//seed, thanks Joe Eames
Food.find({}).exec(function (err, collection) {
if (collection.length === 0) {
Food.create({"name": "Papadums", "description": "Thin white bread", "price": '3,00'});
Food.create({"name": 'Naan', "description": "Delicious traditional bread", "price": '3,00'});
Food.create({"name": 'Dal', "description": 'Veggie lentils recipe', "price": '6,00'});
Food.create({"name": 'Chicken Tikka Massala', "description": 'Tradition chicken in Massala sauce', "price": '16,00'});
}
})
User.find({}).exec(function (err, collection) {
if (collection.length === 0) {
User.register(new User({
username: "[email protected]",
firstname: "admin"
}), "admin");
// User.register({"firstname": "Admin", "username": "[email protected]", "password": 'admin'});
}
})
return dotenv._setEnvs();
};