aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Caldwell <aaronjcaldwell@gmail.com>2018-05-31 13:57:44 -0600
committerGitHub <noreply@github.com>2018-05-31 13:57:44 -0600
commit8f206db2c50349fa63a10fd6a8399a924ba0ee1c (patch)
treefb340e05f2fca2489b0e184381ecea48fb930f18
parent31bd7a2f63cb40dda4269f113d45d9c7c27c61c0 (diff)
Feature/align map config settings (#19450)
* Update config schema to allow map.tilemap & map.regionmap * Inject map.regionmap & map.tilemap. Fall back to top-level config declarations if needed * Warn user on use of legacy map config vals * Don't create default map objects for deprecated entries. Add notes indicating top-level objects are deprecated * Update map references in docs * Shuffle map configurations in docs to be grouped together
-rw-r--r--docs/setup/settings.asciidoc57
-rw-r--r--src/core_plugins/kibana/inject_vars.js21
-rw-r--r--src/server/config/schema.js47
3 files changed, 84 insertions, 41 deletions
diff --git a/docs/setup/settings.asciidoc b/docs/setup/settings.asciidoc
index 9750a0af3..e4dbfdf9e 100644
--- a/docs/setup/settings.asciidoc
+++ b/docs/setup/settings.asciidoc
@@ -72,20 +72,13 @@ error messages.
`map.includeElasticMapsService:`:: *Default: true* Turns on or off whether layers from the Elastic Maps Service should be included in the vector and tile layer option list.
By turning this off, only the layers that are configured here will be included.
-`path.data:`:: *Default: `data`* The path where Kibana stores persistent data not saved in Elasticsearch.
-
-`pid.file:`:: Specifies the path where Kibana creates the process ID file.
-
-`ops.interval:`:: *Default: 5000* Set the interval in milliseconds to sample system and process performance metrics.
-The minimum value is 100.
-
-[[regionmap-settings]] `regionmap:`:: Specifies additional vector layers for use in <<regionmap, Region Map>> visualizations. Supported on Elastic Cloud Enterprise.
+[[regionmap-settings]] `map.regionmap:`:: Specifies additional vector layers for use in <<regionmap, Region Map>> visualizations. Supported on Elastic Cloud Enterprise.
Each layer object points to an external vector file that contains a geojson FeatureCollection.
The file must use the https://en.wikipedia.org/wiki/World_Geodetic_System[WGS84 coordinate reference system] and only include polygons.
If the file is hosted on a separate domain from Kibana, the server needs to be CORS-enabled so Kibana can download the file.
The following example shows a valid regionmap configuration.
- regionmap:
+ map.regionmap:
includeElasticMapsService: false
layers:
- name: "Departments of France"
@@ -97,23 +90,41 @@ The following example shows a valid regionmap configuration.
- name: "INSEE"
description: "INSEE numeric identifier"
-[[regionmap-name]]`regionmap.layers[].name:`:: Mandatory. A description of the map being provided. Supported on Elastic Cloud Enterprise.
+[[regionmap-name]]`map.regionmap.layers[].name:`:: Mandatory. A description of the map being provided. Supported on Elastic Cloud Enterprise.
-[[regionmap-url]]`regionmap.layers[].url:`:: Mandatory. The location of the geojson file as provided by a webserver. Supported on Elastic Cloud Enterprise.
+[[regionmap-url]]`map.regionmap.layers[].url:`:: Mandatory. The location of the geojson file as provided by a webserver. Supported on Elastic Cloud Enterprise.
-[[regionmap-attribution]]`regionmap.layers[].attribution:`:: Optional. References the originating source of the geojson file. Supported on Elastic Cloud Enterprise.
+[[regionmap-attribution]]`map.regionmap.layers[].attribution:`:: Optional. References the originating source of the geojson file. Supported on Elastic Cloud Enterprise.
-[[regionmap-fields]]`regionmap.layers[].fields[]:`:: Mandatory. Each layer can contain multiple fields to indicate what properties from the geojson features you wish to expose. The example above shows how to define multiple properties. Supported on Elastic Cloud Enterprise.
+[[regionmap-fields]]`map.regionmap.layers[].fields[]:`:: Mandatory. Each layer can contain multiple fields to indicate what properties from the geojson features you wish to expose. The example above shows how to define multiple properties. Supported on Elastic Cloud Enterprise.
-[[regionmap-field-name]]`regionmap.layers[].fields[].name:`:: Mandatory. This value is used to do an inner-join between the document stored in Elasticsearch and the geojson file. e.g. if the field in the geojson is called `Location` and has city names, there must be a field in Elasticsearch that holds the same values that Kibana can then use to lookup for the geoshape data. Supported on Elastic Cloud Enterprise.
+[[regionmap-field-name]]`map.regionmap.layers[].fields[].name:`:: Mandatory. This value is used to do an inner-join between the document stored in Elasticsearch and the geojson file. e.g. if the field in the geojson is called `Location` and has city names, there must be a field in Elasticsearch that holds the same values that Kibana can then use to lookup for the geoshape data. Supported on Elastic Cloud Enterprise.
-[[regionmap-field-description]]`regionmap.layers[].fields[].description:`:: Mandatory. The human readable text that is shown under the Options tab when building the Region Map visualization. Supported on Elastic Cloud Enterprise.
+[[regionmap-field-description]]`map.regionmap.layers[].fields[].description:`:: Mandatory. The human readable text that is shown under the Options tab when building the Region Map visualization. Supported on Elastic Cloud Enterprise.
-[[regionmap-ES-map]]`regionmap.includeElasticMapsService:`:: turns on or off whether layers from the Elastic Maps Service should be included in the vector layer option list. Supported on Elastic Cloud Enterprise.
+[[regionmap-ES-map]]`map.regionmap.includeElasticMapsService:`:: turns on or off whether layers from the Elastic Maps Service should be included in the vector layer option list. Supported on Elastic Cloud Enterprise.
By turning this off, only the layers that are configured here will be included. The default is true.
+[[tilemap-settings]] `map.tilemap.options.attribution:`:: *Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`* The map attribution string. Supported on Elastic Cloud Enterprise.
+
+[[tilemap-max-zoom]]`map.tilemap.options.maxZoom:`:: *Default: 10* The maximum zoom level. Supported on Elastic Cloud Enterprise.
+
+[[tilemap-min-zoom]]`map.tilemap.options.minZoom:`:: *Default: 1* The minimum zoom level. Supported on Elastic Cloud Enterprise.
+
+[[tilemap-subdomains]]`map.tilemap.options.subdomains:`:: An array of subdomains used by the tile service.
+Specify the position of the subdomain the URL with the token `{s}`. Supported on Elastic Cloud Enterprise.
+
+[[tilemap-url]]`map.tilemap.url:`:: The URL to the tileservice that Kibana uses to display map tiles in tilemap visualizations. Supported on Elastic Cloud Enterprise.
+By default, Kibana reads this url from an external metadata service, but users can still override this parameter to use their own Tile Map Service. For example: `"https://tiles.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana"`
`server.basePath:`:: Enables you to specify a path to mount Kibana at if you are running behind a proxy. Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath from requests it receives, and to prevent a deprecation warning at startup. This setting cannot end in a slash (`/`).
+`path.data:`:: *Default: `data`* The path where Kibana stores persistent data not saved in Elasticsearch.
+
+`pid.file:`:: Specifies the path where Kibana creates the process ID file.
+
+`ops.interval:`:: *Default: 5000* Set the interval in milliseconds to sample system and process performance metrics.
+The minimum value is 100.
+
`server.rewriteBasePath:`:: *Default: false* Specifies whether Kibana should rewrite requests that are prefixed with `server.basePath` or require that they are rewritten by your reverse proxy. This setting was effectively always `false` before Kibana 6.3 and will default to `true` starting in Kibana 7.0.
`server.customResponseHeaders:`:: *Default: `{}`* Header names and values to send on all responses to the client from the Kibana server.
@@ -143,16 +154,4 @@ By turning this off, only the layers that are configured here will be included.
`server.ssl.supportedProtocols:`:: *Default: TLSv1, TLSv1.1, TLSv1.2* Supported protocols with versions. Valid protocols: `TLSv1`, `TLSv1.1`, `TLSv1.2`
`status.allowAnonymous:`:: *Default: false* If authentication is enabled, setting this to `true` allows
-unauthenticated users to access the Kibana server status API and status page.
-
-[[tilemap-settings]] `tilemap.options.attribution:`:: *Default: `"© [Elastic Maps Service](https://www.elastic.co/elastic-maps-service)"`* The map attribution string. Supported on Elastic Cloud Enterprise.
-
-[[tilemap-max-zoom]]`tilemap.options.maxZoom:`:: *Default: 10* The maximum zoom level. Supported on Elastic Cloud Enterprise.
-
-[[tilemap-min-zoom]]`tilemap.options.minZoom:`:: *Default: 1* The minimum zoom level. Supported on Elastic Cloud Enterprise.
-
-[[tilemap-subdomains]]`tilemap.options.subdomains:`:: An array of subdomains used by the tile service.
-Specify the position of the subdomain the URL with the token `{s}`. Supported on Elastic Cloud Enterprise.
-
-[[tilemap-url]]`tilemap.url:`:: The URL to the tileservice that Kibana uses to display map tiles in tilemap visualizations. Supported on Elastic Cloud Enterprise.
-By default, Kibana reads this url from an external metadata service, but users can still override this parameter to use their own Tile Map Service. For example: `"https://tiles.elastic.co/v2/default/{z}/{x}/{y}.png?elastic_tile_service_tos=agree&my_app_name=kibana"`
+unauthenticated users to access the Kibana server status API and status page. \ No newline at end of file
diff --git a/src/core_plugins/kibana/inject_vars.js b/src/core_plugins/kibana/inject_vars.js
index 83737bbf0..7a95c450b 100644
--- a/src/core_plugins/kibana/inject_vars.js
+++ b/src/core_plugins/kibana/inject_vars.js
@@ -23,14 +23,25 @@ export function injectVars(server) {
//DEPRECATED SETTINGS
//if the url is set, the old settings must be used.
//keeping this logic for backward compatibilty.
- const configuredUrl = server.config().get('tilemap.url');
+ const configuredUrl = serverConfig.get('tilemap.url');
const isOverridden = typeof configuredUrl === 'string' && configuredUrl !== '';
- const tilemapConfig = serverConfig.get('tilemap');
- const regionmapsConfig = serverConfig.get('regionmap');
const mapConfig = serverConfig.get('map');
+ // Fall back to top-level legacy map config settings if needed. Warn on usage
+ const tilemapsConfig = serverConfig.get('map.tilemap') || serverConfig.get('tilemap');
+ const regionmapsConfig = serverConfig.get('map.regionmap') || serverConfig.get('regionmap');
- regionmapsConfig.layers = (regionmapsConfig.layers) ? regionmapsConfig.layers : [];
+ ['tilemap', 'regionmap'].forEach(legacyMap => {
+ const hasLegacyMap = serverConfig.has(legacyMap);
+ const legacyMapDef = serverConfig.get(legacyMap);
+ if (hasLegacyMap && typeof legacyMapDef !== 'undefined') {
+ server.log(['warning', 'deprecated'],
+ `Use of "${legacyMap}" in the kibana configuration is deprecated. ` +
+ `Use "map.${legacyMap}" instead`);
+ }
+ });
+
+ regionmapsConfig.layers = (regionmapsConfig.layers) ? regionmapsConfig.layers : [];
return {
kbnDefaultAppId: serverConfig.get('kibana.defaultAppId'),
@@ -39,7 +50,7 @@ export function injectVars(server) {
tilemapsConfig: {
deprecated: {
isOverridden: isOverridden,
- config: tilemapConfig,
+ config: tilemapsConfig,
}
}
};
diff --git a/src/server/config/schema.js b/src/server/config/schema.js
index 64ed289f2..ae3fe78a4 100644
--- a/src/server/config/schema.js
+++ b/src/server/config/schema.js
@@ -126,7 +126,6 @@ export default async () => Joi.object({
then: Joi.valid(false).default(false),
otherwise: Joi.default(false)
}),
-
events: Joi.any().default({}),
dest: Joi.string().default('stdout'),
filter: Joi.any().default({}),
@@ -136,10 +135,8 @@ export default async () => Joi.object({
then: Joi.default(!process.stdout.isTTY),
otherwise: Joi.default(true)
}),
-
useUTC: Joi.boolean().default(true),
- })
- .default(),
+ }).default(),
ops: Joi.object({
interval: Joi.number().default(5000),
@@ -194,6 +191,42 @@ export default async () => Joi.object({
allowAnonymous: Joi.boolean().default(false)
}).default(),
map: Joi.object({
+ tilemap: Joi.object({
+ url: Joi.string(),
+ options: Joi.object({
+ attribution: Joi.string(),
+ minZoom: Joi.number().min(0, 'Must be 0 or higher').default(0),
+ maxZoom: Joi.number().default(10),
+ tileSize: Joi.number(),
+ subdomains: Joi.array().items(Joi.string()).single(),
+ errorTileUrl: Joi.string().uri(),
+ tms: Joi.boolean(),
+ reuseTiles: Joi.boolean(),
+ bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2)
+ }).default()
+ }).default(),
+ regionmap: Joi.object({
+ includeElasticMapsService: Joi.boolean().default(true),
+ layers: Joi.array().items(Joi.object({
+ url: Joi.string(),
+ format: Joi.object({
+ type: Joi.string().default('geojson')
+ }).default({
+ type: 'geojson'
+ }),
+ meta: Joi.object({
+ feature_collection_path: Joi.string().default('data')
+ }).default({
+ feature_collection_path: 'data'
+ }),
+ attribution: Joi.string(),
+ name: Joi.string(),
+ fields: Joi.array().items(Joi.object({
+ name: Joi.string(),
+ description: Joi.string()
+ }))
+ }))
+ }).default(),
manifestServiceUrl: Joi.when('$dev', {
is: true,
then: Joi.string().default('https://staging-dot-catalogue-dot-elastic-layer.appspot.com/v2/manifest'),
@@ -213,8 +246,8 @@ export default async () => Joi.object({
tms: Joi.boolean(),
reuseTiles: Joi.boolean(),
bounds: Joi.array().items(Joi.array().items(Joi.number()).min(2).required()).min(2)
- }).default()
- }).default(),
+ })
+ }).notes('Deprecated'),
regionmap: Joi.object({
includeElasticMapsService: Joi.boolean().default(true),
layers: Joi.array().items(Joi.object({
@@ -236,7 +269,7 @@ export default async () => Joi.object({
description: Joi.string()
}))
}))
- }).default(),
+ }).notes('Deprecated'),
i18n: Joi.object({
defaultLocale: Joi.string().default('en'),