prerender-bwlist

0.0.2 • Public • Published

Prerender Black/Whitelist Plugin

Easy and comfortable Black-/Whitelisting configuration plugin for Prerender Service (from prerender.io). Configuration can be set through a json file or directly from within your prerender server.

Code Climate

Usage

var bwlist = require('prerender-bwlist');
server.use(bwlist);

Configuration

Inline

You can set the config directly inside your prerender server.

var prerender = require('prerender')
  , bwlist = require('prerender-bwlist');
 
var server = prerender({
    workers: process.env.PHANTOM_CLUSTER_NUM_WORKERS,
    iterations: process.env.PHANTOM_WORKER_ITERATIONS || 10,
    phantomArguments: ["--load-images=false", "--ignore-ssl-errors=true"],
    phantomBasePort: process.env.PHANTOM_CLUSTER_BASE_PORT,
    messageTimeout: process.env.PHANTOM_CLUSTER_MESSAGE_TIMEOUT
});
 
// Either specify a folder path
bwlist.setConf(__dirname + '/prerender-bwlist/bwlist.sample.json');
 
// Or set it directly (this will overwrite the previous bit!)
bwlist.setConf({
    "whitelist": {
        "enabled": true,
        "list": [
            "google.ch",
            "www.google.ch"
        ]
    },
    "blacklist": {
        "enabled": false,
        "list": []
    }
});
 
// Finally tell Prerender to use the configured plugin
server.use(bwlist);
server.start();

If bwlist.setConf is not called prerender-bwlist will look for a bwlist.json file in your app's root folder.

Through a bwlist.json

Create a bwlist.json from bwlist.sample.json in your app's root folder

{
    "whitelist": {
        "enabled": true,
        "list": ["google.ch", "www.google.ch"]
    },
    "blacklist": {
    "enabled": false,
        "list": []
    }
}

Alternatively specify a different location for your bwlist.json through an environment variable

BWLIST_CONF=/path/to/bwlist.json

or inline with bwlist.setConf

Package Sidebar

Install

npm i prerender-bwlist

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • d-simon