forked from prerender/prerender
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprerender.js
executable file
·38 lines (31 loc) · 1.01 KB
/
prerender.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
#!/usr/bin/env node
var prerender = require('./lib');
var config = require('config');
var logger = require('./lib/logger')('prerender');
var server = prerender({
workers: config.phantom_cluster_num_workers,
iterations: config.phantom_worker_iterations || 10,
phantomBasePort: config.phantom_cluster_base_port || 12300,
messageTimeout: config.phantom_cluster_message_timeout
});
// server.use(prerender.basicAuth());
// server.use(prerender.whitelist());
server.use(prerender.blacklist());
server.use(prerender.logger());
server.use(prerender.removeScriptTags());
server.use(prerender.httpHeaders());
server.use(prerender.removeIframes());
if (process.env.NODE_ENV !== 'development') {
logger.info('Setting up s3HtmlCache'.green);
server.use(prerender.s3HtmlCache());
}
if (config.aws) {
server.use(prerender.snsNotify());
}
server.start();
process.on('uncaughtException', function (err) {
console.log('uncaughtException: ', err);
logger.error(err);
logger.error(err.stack);
process.exit(1);
});