Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
/ prerender-bwlist Public archive

Prerender server plugin for easy file-based or inline configuration of black- and whitelisting hosts

Notifications You must be signed in to change notification settings

d-simon/prerender-bwlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Prerender server plugin for easy file-based or inline configuration of black- and whitelisting hosts

Resources

Stars

Watchers

Forks

Packages

No packages published