-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeystone.js
More file actions
executable file
·134 lines (104 loc) · 3.85 KB
/
keystone.js
File metadata and controls
executable file
·134 lines (104 loc) · 3.85 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Simulate config options from your production environment by
// customising the .env file in your project's root folder.
require('dotenv').load();
// Require keystone
var keystone = require('keystone');
var args = require('minimist')(process.argv.slice(2));
// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
// and documentation.
keystone.init({
'name': 'MFDPatientCare',
'brand': 'MFDPatientCare',
'port': 5000,
'less': 'public',
'static': 'public',
'favicon': 'public/favicon.ico',
'views': 'templates/views',
'view engine': 'jade',
'emails': 'templates/emails',
'auto update': true,
'session': true,
'auth': true,
'user model': 'User',
'cookie secret': 'i7NZZ2o]>V!]X;t4XTM(%=/,W:)dWan5epq0!#:g%XSruaH5?q*/I/x:m(mQ(<h|',
'signin url': '/keystone/signin',
'signin redirect': '/',
'signout redirect': '/keystone/signin',
'signout url': '/keystone/signout'
});
// Load your project's Models
keystone.import('models');
// Setup common locals for your templates. The following are required for the
// bundled templates and layouts. Any runtime locals (that should be set uniquely
// for each request) should be added to ./routes/middleware.js
keystone.set('locals', {
_: require('underscore'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable,
title: 'MFDPatientCare',
signout_url: keystone.get('signout url')
});
keystone.set('google api key', 'AIzaSyAr1qAP9HAR9nZpTyBa2nPlpvZOCwxfbRc');
keystone.set('google server', 'AIzaSyDuwcWqGs6nAnnCr4aykqxUrILpYih209M');
// Load your project's Routes
keystone.set('routes', require('./routes'));
// Setup common locals for your emails. The following are required by Keystone's
// default email templates, you may remove them if you're using your own.
keystone.set('email locals', {
logo_src: '/images/logo-email.gif',
logo_width: 194,
logo_height: 76,
theme: {
email_bg: '#f9f9f9',
link_color: '#2697de',
buttons: {
color: '#fff',
background_color: '#2697de',
border_color: '#1a7cb7'
}
}
});
// Setup replacement rules for emails, to automate the handling of differences
// between development a production.
// Be sure to update this rule to include your site's actual domain, and add
// other rules your email templates require.
keystone.set('email rules', [{
find: '/images/',
replace: (keystone.get('env') == 'production') ? 'http://www.your-server.com/images/' : 'http://localhost:3000/images/'
}, {
find: '/keystone/',
replace: (keystone.get('env') == 'production') ? 'http://www.your-server.com/keystone/' : 'http://localhost:3000/keystone/'
}]);
// Load your project's email test routes
keystone.set('email tests', require('./routes/emails'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
'users': 'users',
'patients': 'patients',
'data': ['questions', 'answers', 'comments']
});
// Google Maps API Config
keystone.set('google api key', 'AIzaSyAr1qAP9HAR9nZpTyBa2nPlpvZOCwxfbRc');
keystone.set('google server api key', 'AIzaSyCxo8Li0ILh5O30duXohrXowV3SqU3mqZ0');
keystone.set('default region', 'us');
// Mandrill API Configs
keystone.set('mandrill api key', 'HQgwQwPutKcYLX-x0fBH7Q');
keystone.set('mandrill username', 'rdbcasillas11@gmail.com');
// Time-Elapsed Notifications
keystone.set('alert-elapse', 3); // days
var check_elapse = require('./scheduled/check_elapse');
check_elapse(keystone);
// Start Keystone to connect to your database and initialise the web server
// Or start a REPL console to perform Mongoose Queries
if (args.repl) {
var monrepl = require('./node_modules/mongoose-repl/lib-js/mongoose-repl')
var schemas = new Object();
var getSchema = function(m) { schemas[m] = keystone.lists[m].schema;};
Object.keys(keystone.lists).map(getSchema);
monrepl.run(schemas, keystone.mongoose, 'localhost/mfdpatientcare')
}
else {
keystone.start();
}