Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fs.readFile('public/js/publicsettings.json', 'utf8', function(err, data) {
//debugger;
if(err) {
console.log('Error in keystone.js while trying to read publicsettings.json file.');
console.log(err);
} else {
var publicSettings = JSON.parse(data);
if(typeof(publicSettings.superUsers) == "string") {
keystone.set('superusers', [publicSettings.superUsers]);
} else {
keystone.set('superusers', publicSettings.superUsers);
}
if(typeof(publicSettings.adminUsers) == "string") {
keystone.set('admins', [publicSettings.adminUsers]);
} else {
keystone.set('admins', publicSettings.adminUsers);
}
// Start Keystone to connect to your database and initialise the web server
// Need to be inside the readFile function handler.
keystone.start();
}
});
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
});
// Setup Store Gateway
keystone.set('store gateway', 'stripe')
// Setup Default Country
keystone.set('store country', 'Canada')
// Setup Stripe keys
keystone.set('stripe secret key', process.env.STRIPE_SECRET_KEY || 'STRIPE_SECRET_KEY')
keystone.set('stripe publishable key', process.env.STRIPE_PUBLISHABLE_KEY || 'STRIPE_PUBLISHABLE_KEY')
// Load your project's Routes
keystone.set('routes', require('./routes'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
'posts': ['posts', 'post-categories'],
'galleries': 'galleries',
'enquiries': 'enquiries',
// 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('lodash'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable,
});
// Load your project's Routes
keystone.set('routes', require('./routes'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
users: 'users',
});
// Start Keystone to connect to your database and initialise the web server
keystone.start();
'auth': true,
'user model': 'User',
'cookie secret': '0T=?C|`ed@N&,<!)BQ<Nh/7+e3TeO"$^cl{7Z$7i@mfnybN1{*H.ETQ=(->75^MB'
});
keystone.import('models');
keystone.set('locals', {
// _: require('underscore'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable
});
keystone.set('routes', require('./routes'));
keystone.set('nav', {
// 'bills': 'bills'
});
keystone.start();
// 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('lodash'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable,
});
// Load your project's Routes
keystone.set('routes', require('./routes'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
'pages': [
'home-pages',
'faq-pages',
'contact-pages',
],
'data' : [
'faqs',
'media-items',
'contact-enquiries',
],
'configuration' : [ 'site-configurations' ],
'users' : [ 'users' ],
});
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
});
// 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'
}
// 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('lodash'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable,
});
// Load your project's Routes
keystone.set('routes', require('./cms/routes'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
Plant: ['plants', 'plant-categories' ],
users: 'users',
});
export default (app) => {
keystone.app = app;
return keystone;
};
from: {
name: 'Keystone Test Project',
email: 'test@keystonejs.com',
},
subject: 'Keystone Test Email!',
}, function (err, result) {
if (err) {
console.error('🤕 Mailgun test failed with error:\n', err);
} else {
console.log('📬 Successfully sent Mailgun test with result:\n', result);
}
});
}
if (mandrillApiKey) {
keystone.set('mandrill api key', mandrillApiKey);
new keystone.Email({
templateName: template,
templateExt: 'pug',
transport: 'mandrill',
}).send({}, {
to: [to],
from: {
name: 'Keystone Test Project',
email: 'test@keystonejs.com',
},
subject: 'Keystone Test Email!',
}, function (err, result) {
if (err) {
console.error('🤕 Mandrill test failed with error:\n', err);
} else {
}
});
//Update the list of superusers stored in memory
if(typeof(data.superUsers) == "string") {
keystone.set('superusers', [data.superUsers]);
} else {
keystone.set('superusers', data.superUsers);
}
console.log('superusers = '+keystone.get('superusers'));
//Update the list of admins stored in memory
if(typeof(data.adminUsers) == "string") {
keystone.set('admins', [data.adminUsers]);
} else {
keystone.set('admins', data.adminUsers);
}
console.log('admins = '+keystone.get('admins'));
//Temporary code for debugging.
var admins = keystone.get('admins');
var superusers = keystone.get('superusers');
console.log('admins = '+admins);
console.log('superusers = '+superusers);
//Rejects the API if the user is not a superuser.
}, function(err) {
console.log('/api/serversettings/saveprivate exited with error '+err);
chartbeat_property: keystone.get('chartbeat property'),
chartbeat_domain: keystone.get('chartbeat domain')
});
keystone.set('email locals', {
keystoneURL: 'http://www.keystonejs.com/keystone',
logo: '/images/logo_email.jpg',
logo_width: 120,
logo_height: 112,
theme: {
email_bg: '#f9f9f9',
link_color: '#2697de'
}
});
keystone.set('email tests', {
'forgotten-password': {
name: 'User',
link: 'http://forum.keystonejs.com/reset-password/key'
}
});
keystone.set('nav', {
'users': ['users'],
'topics': ['topics', 'replies', 'tags']
});
keystone.start();