-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystone.js
64 lines (51 loc) · 1.71 KB
/
keystone.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require('dotenv').config();
const keystone = require('keystone');
const handlebars = require('express-handlebars');
const port = process.env.PORT || 7000;
keystone.init({
'name': 'DMS',
'brand': 'DMS',
'sass': 'public',
'static': 'public',
'favicon': 'public/favicon.ico',
'views': 'templates/views',
'view engine': '.hbs',
'mongo': process.env.MONGO_URI,
'custom engine': handlebars.create({
layoutsDir: 'templates/views/layouts',
partialsDir: 'templates/views/partials',
defaultLayout: 'default',
helpers: new require('./templates/views/helpers')(),
extname: '.hbs',
}).engine,
'emails': 'templates/emails',
'auto update': true,
'session': true,
'auth': true,
'user model': 'User',
});
keystone.import('models');
keystone.set('admin path', 'admin');
keystone.set('locals', {
_: require('lodash'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable,
});
keystone.set('routes', require('./routes'));
keystone.set('cloudinary config', process.env.CLOUDINARY_URL);
keystone.set('cookie secret', process.env.COOKIE_SECRET);
keystone.set('signin logo', '../images/logo.png');
keystone.set('signin url', '/');
keystone.set('signin redirect', '/');
// if (!process.env.MAILGUN_API_KEY || !process.env.MAILGUN_DOMAIN) {
// console.log('----------------------------------------'
// + '\nWARNING: MISSING MAILGUN CREDENTIALS'
// + '\n----------------------------------------'
// + '\nYou have opted into email sending but have not provided'
// + '\nmailgun credentials. Attempts to send will fail.'
// + '\n\nCreate a mailgun account and add the credentials to the .env file to'
// + '\nset up your mailgun integration');
// }
keystone.set('port', port);
keystone.start();