mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Upgrades Hapi to 14.2.0
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:8e8959d3ee
Iron's resolution:9e0a1ef592
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). https://github.com/hapijs/hapi/issues/2682 Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
85234ed6de
commit
4feeff1bb9
7 changed files with 40 additions and 18 deletions
|
@ -114,10 +114,12 @@
|
|||
"glob-all": "3.0.1",
|
||||
"good-squeeze": "2.1.0",
|
||||
"gridster": "0.5.6",
|
||||
"hapi": "8.8.1",
|
||||
"h2o2": "5.1.1",
|
||||
"hapi": "14.2.0",
|
||||
"highland": "2.7.2",
|
||||
"httpolyglot": "0.1.1",
|
||||
"imports-loader": "0.6.4",
|
||||
"inert": "4.0.2",
|
||||
"jade": "1.11.0",
|
||||
"jade-loader": "0.7.1",
|
||||
"joi": "6.6.1",
|
||||
|
@ -154,6 +156,7 @@
|
|||
"trunc-text": "1.0.2",
|
||||
"url-loader": "0.5.6",
|
||||
"validate-npm-package-name": "2.2.2",
|
||||
"vision": "4.1.0",
|
||||
"webpack": "1.12.15",
|
||||
"webpack-directory-name-as-main": "1.0.0",
|
||||
"whatwg-fetch": "0.9.0",
|
||||
|
|
|
@ -8,6 +8,7 @@ import { readFileSync } from 'fs';
|
|||
|
||||
import Config from '../../server/config/config';
|
||||
import setupConnection from '../../server/http/setup_connection';
|
||||
import registerHapiPlugins from '../../server/http/register_hapi_plugins';
|
||||
import setupLogging from '../../server/logging';
|
||||
import { DEV_SSL_CERT_PATH } from '../dev_ssl';
|
||||
|
||||
|
@ -44,6 +45,8 @@ export default class BasePathProxy {
|
|||
|
||||
setupLogging(null, this.server, config);
|
||||
setupConnection(null, this.server, config);
|
||||
registerHapiPlugins(null, this.server, config);
|
||||
|
||||
this.setupRoutes();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,12 +30,11 @@ describe('plugins/elasticsearch', function () {
|
|||
return kbnServer.close();
|
||||
});
|
||||
|
||||
function testRoute(options) {
|
||||
function testRoute(options, statusCode = 200) {
|
||||
if (typeof options.payload === 'object') {
|
||||
options.payload = JSON.stringify(options.payload);
|
||||
}
|
||||
|
||||
const statusCode = options.statusCode || 200;
|
||||
describe(format('%s %s', options.method, options.url), function () {
|
||||
it('should should return ' + statusCode, function (done) {
|
||||
kbnTestServer.makeRequest(kbnServer, options, function (res) {
|
||||
|
@ -62,21 +61,18 @@ describe('plugins/elasticsearch', function () {
|
|||
|
||||
testRoute({
|
||||
method: 'POST',
|
||||
url: '/elasticsearch/.kibana',
|
||||
statusCode: 405
|
||||
});
|
||||
url: '/elasticsearch/.kibana'
|
||||
}, 405);
|
||||
|
||||
testRoute({
|
||||
method: 'PUT',
|
||||
url: '/elasticsearch/.kibana',
|
||||
statusCode: 405
|
||||
});
|
||||
url: '/elasticsearch/.kibana'
|
||||
}, 405);
|
||||
|
||||
testRoute({
|
||||
method: 'DELETE',
|
||||
url: '/elasticsearch/.kibana',
|
||||
statusCode: 405
|
||||
});
|
||||
url: '/elasticsearch/.kibana'
|
||||
}, 405);
|
||||
|
||||
testRoute({
|
||||
method: 'GET',
|
||||
|
@ -86,9 +82,8 @@ describe('plugins/elasticsearch', function () {
|
|||
testRoute({
|
||||
method: 'POST',
|
||||
url: '/elasticsearch/.kibana/_bulk',
|
||||
payload: '{}',
|
||||
statusCode: 400
|
||||
});
|
||||
payload: '{}'
|
||||
}, 400);
|
||||
|
||||
testRoute({
|
||||
method: 'POST',
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
import Boom from 'boom';
|
||||
import { Server } from 'hapi';
|
||||
import { fromNode } from 'bluebird';
|
||||
|
||||
import registerHapiPlugins from '../../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
|
||||
|
|
|
@ -4,15 +4,18 @@ import _ from 'lodash';
|
|||
import fs from 'fs';
|
||||
import Boom from 'boom';
|
||||
import Hapi from 'hapi';
|
||||
import HapiTemplates from 'vision';
|
||||
import HapiStaticFiles from 'inert';
|
||||
import HapiProxy from 'h2o2';
|
||||
import getDefaultRoute from './get_default_route';
|
||||
import versionCheckMixin from './version_check';
|
||||
|
||||
module.exports = async function (kbnServer, server, config) {
|
||||
|
||||
|
||||
server = kbnServer.server = new Hapi.Server();
|
||||
|
||||
const shortUrlLookup = require('./short_url_lookup')(server);
|
||||
await kbnServer.mixin(require('./register_hapi_plugins'));
|
||||
await kbnServer.mixin(require('./setup_connection'));
|
||||
|
||||
// provide a simple way to expose static directories
|
||||
|
|
16
src/server/http/register_hapi_plugins.js
Normal file
16
src/server/http/register_hapi_plugins.js
Normal file
|
@ -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);
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
import Hapi from 'hapi';
|
||||
import { constant, once, compact, flatten } from 'lodash';
|
||||
import { promisify, resolve, fromNode } from 'bluebird';
|
||||
import { isWorker } from 'cluster';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue