mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
[plugins] re-enable publicDir option, but require that it is "public"
This commit is contained in:
parent
3bb600336d
commit
723847468b
1 changed files with 14 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
let _ = require('lodash');
|
||||
let Joi = require('joi');
|
||||
let { attempt, fromNode } = require('bluebird');
|
||||
let { resolve } = require('path');
|
||||
let { basename, resolve } = require('path');
|
||||
let { inherits } = require('util');
|
||||
|
||||
const defaultConfigSchema = Joi.object({
|
||||
|
@ -18,11 +18,23 @@ module.exports = class Plugin {
|
|||
this.uiExportsSpecs = opts.uiExports || {};
|
||||
this.requiredIds = opts.require || [];
|
||||
this.version = opts.version || pkg.version;
|
||||
this.publicDir = opts.publicDir !== false ? resolve(path, 'public') : null;
|
||||
this.externalCondition = opts.initCondition || _.constant(true);
|
||||
this.externalInit = opts.init || _.noop;
|
||||
this.getConfigSchema = opts.config || _.noop;
|
||||
this.init = _.once(this.init);
|
||||
|
||||
if (opts.publicDir === false) {
|
||||
this.publicDir = null;
|
||||
}
|
||||
else if (!opts.publicDir) {
|
||||
this.publicDir = resolve(this.path, 'public');
|
||||
}
|
||||
else {
|
||||
this.publicDir = opts.publicDir;
|
||||
if (basename(this.publicDir) !== 'public') {
|
||||
throw new Error(`publicDir for plugin ${this.id} must end with a "public" directory.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static scoped(kbnServer, path, pkg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue