Socket
Book a DemoInstallSign in
Socket

@kizzlebot/hapi-plugins

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kizzlebot/hapi-plugins

Hapi plugin to autoload other plugins.

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@kizzlebot/hapi-plugins

Build Status Dependencies Dev dependencies

Plugin to autoload plugins given relative path and glob pattern. Optionally, options.plugins[pluginName] can be used to pass arguments to plugins

How to use:

  • Install hapi-plugins npm package in your project our plugin. npm i @flexshopper/hapi-plugins
  • Register plugin in your hapi server:

Registering

const server = new Hapi.Server();

server.connection();

server.register({
    register: require('hapi-plugins'),
    options: {
        relativeTo: proccess.cwd() + '/plugins',
        includes: ['path/to/**/*plugins.js'],
        ignore: ['*.git'],
        // plugin options
        plugins: {
            myPlugin: {
                host: '192.168.1.1'
            }
        }
    }
}, (err) => {
  // continue application
});

manifest style:

registrations: [
    ...
    {
        plugin: {
            register: 'hapi-plugins',
            options: {
                relativeTo: proccess.cwd() + '/plugins',
                includes: ['path/to/**/*plugins.js'],
                ignore: ['*.git'],
                // plugin options
                plugins: {
                    myPlugin: {
                        host: '192.168.1.1'
                    }
                }
            }
        }
    }
];

Options

includes

Required
Type: array

The glob pattern you would like to include

ignore

Type: array

The pattern or an array of patterns to exclude

relativeTo

Type: string

The current working directory in which to search (defaults to process.cwd())

plugins

Type: object

key-value where key is your plugin name (ie internals.register.attributes.name) and value is options to pass to plugin

Route Signature

'use strict';

const internals = module.exports = {};
internals.register = (server, options, next) => {
    // ...do stuff

    return next();
};

internals.register.attributes = {
    name: 'myplugin:',
    version: '0.0.1'
};

Keywords

hapi

FAQs

Package last updated on 12 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.