xpr-hapi
v1.0.0
Published
Hapi.js plugin for XPRMNTL feature-client
Downloads
1
Readme
xpr-hapi
Install
npm install xpr-hapi
Options
Can be configured with options following this schema:
{
timeout: 10000,
featureUrl: 'https://example.com/',
devKey: 'xxxxxxx',
cookieName: 'xpr.config'
experiments: [
{
name: 'featureFlagTest',
default: true,
description: 'This is a test feature flag.',
},
],
cronTime: '* * * * *',
callback: (err, settings) => {
// ...
},
announce: true,
reference: 'local',
}
Options specific to this plugin:
crontTime
: Used to callfeatureClient.cron(...);
. Defaults offannounce
: Used to determine if experiments are announced viafeatureClient.announce()
. Defaults offcallback
: The callback passedcron()
andannounce()
Example
Below is an example plugin loading script:
'use strict';
const xprHapi = require('xpr-hapi');
module.exports = {
register: xprHapi,
options: {
featureUrl: 'https://example.com/',
devKey: '1z-2a-3y-4b-5x-6c',
experiments: [
{
name: 'featureFlagTest',
default: true,
description: 'This is a test feature flag.',
},
],
cronTime: '* * * * *',
announce: false,
reference: 'int',
},
};