Skip to content

Commit

Permalink
Upgrades Hapi to 14.2.0
Browse files Browse the repository at this point in the history
As of Node 6, crypto.pbkdf emits a deprecation warning when the digest isn't explicily set. Under certain conditions we are seeing this warning from Hapi's dependency Iron. Iron resolved this issue as of 4.0.4, which was introduced into Hapi as of 14.0.0.

Node deprecation: nodejs/node@8e8959d
Iron's resolution: hapijs/iron@9e0a1ef

As of Hapi v9, they have removed three build-in plugins from the core which we rely on inert (files and directories), vision (view templates), and h2o2 (proxy). hapijs/hapi#2682

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Oct 3, 2016
1 parent 95712a3 commit 8a2aa76
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -103,8 +103,10 @@
"good": "6.3.0",
"good-squeeze": "2.1.0",
"gridster": "0.5.6",
"hapi": "8.8.1",
"h2o2": "5.1.1",
"hapi": "14.2.0",
"imports-loader": "0.6.4",
"inert": "4.0.2",
"jade": "1.11.0",
"jade-loader": "0.7.1",
"joi": "6.6.1",
Expand Down Expand Up @@ -133,6 +135,7 @@
"style-loader": "0.12.3",
"tar": "2.2.0",
"url-loader": "0.5.6",
"vision": "4.1.0",
"webpack": "1.12.15",
"webpack-directory-name-as-main": "1.0.0",
"whatwg-fetch": "0.9.0",
Expand Down
6 changes: 5 additions & 1 deletion src/optimize/lazy/LazyServer.js
Expand Up @@ -2,16 +2,20 @@
let { Server } = require('hapi');
let { fromNode } = require('bluebird');
let Boom = require('boom');

let registerHapiPlugins = require('../../server/http/register_hapi_plugins');

module.exports = class LazyServer {
constructor(host, port, optimizer) {
this.optimizer = optimizer;
this.server = new Server();

registerHapiPlugins(null, this.server);

this.server.connection({
host: host,
port: port
});

}

async init() {
Expand Down
1 change: 1 addition & 0 deletions src/server/http/index.js
Expand Up @@ -13,6 +13,7 @@ module.exports = function (kbnServer, server, config) {
server = kbnServer.server = new Hapi.Server();

const shortUrlLookup = require('./short_url_lookup')(server);
kbnServer.mixin(require('./register_hapi_plugins'));

// Create a new connection
let connectionOptions = {
Expand Down
16 changes: 16 additions & 0 deletions src/server/http/register_hapi_plugins.js
@@ -0,0 +1,16 @@
import HapiTemplates from 'vision';
import HapiStaticFiles from 'inert';
import HapiProxy from 'h2o2';
import { fromNode } from 'bluebird';

const plugins = [HapiTemplates, HapiStaticFiles, HapiProxy];

async function registerPlugins(server) {
await fromNode(cb => {
server.register(plugins, cb);
});
}

export default function (kbnServer, server, config) {
registerPlugins(server);
}

0 comments on commit 8a2aa76

Please sign in to comment.