You can gain access to kibana.yml variables with server.config().get(). Then in your plugin registration, you can pass any kibana.yml variables to the client with injectDefaultVars.
server error [08:07:09.992] Error: Unknown config key: elasticsearch.hosts
at Config.get (/home/asf/kibana_source/kibana/src/legacy/server/config/config.js:147:15)
at fn (/home/asf/kibana_source/kibana/plugins/vms-reporter-kibana-plugin/index.js:27:29)
...
Yes. But error raise when web page loads for the first time (in my case getting http://localhost:5603/dev/), not when getting a value from config object.
server log [12:18:44.826] [info][listening] Server running at http://localhost:5603/dev
server log [12:18:49.865] [info][server][Kibana][http] http server running at http://localhost:5603/dev
server error [12:18:51.014] Error: Unknown config key: elasticsearch.hosts
at Config.get (/home/asf/kibana_source/kibana/src/legacy/server/config/config.js:147:15)
at fn (/home/asf/kibana_source/kibana/plugins/vms-reporter-kibana-plugin/index.js:27:29)
at reduce (/home/asf/kibana_source/kibana/src/core/server/legacy/legacy_internals.ts:50:25)
at Array.reduce (<anonymous>)
at LegacyInternals.defaultVars (/home/asf/kibana_source/kibana/src/core/server/legacy/legacy_internals.ts:48:66)
at LegacyInternals.getVars (/home/asf/kibana_source/kibana/src/core/server/legacy/legacy_internals.ts:89:22)
at renderApp (/home/asf/kibana_source/kibana/src/legacy/ui/ui_render/ui_render_mixin.js:192:31)
at internals.Toolkit.renderAppWithDefaultConfig (/home/asf/kibana_source/kibana/src/legacy/ui/ui_render/ui_render_mixin.js:210:12)
at handler (/home/asf/kibana_source/kibana/plugins/opendistro_security/lib/auth/types/basicauth/routes.js:85:26)
at module.exports.internals.Manager.execute (/home/asf/kibana_source/kibana/node_modules/hapi/lib/toolkit.js:35:106)
at Object.internals.handler (/home/asf/kibana_source/kibana/node_modules/hapi/lib/handler.js:50:48)
at exports.execute (/home/asf/kibana_source/kibana/node_modules/hapi/lib/handler.js:35:36)
at module.exports.internals.Core.constructor.Request._lifecycle (/home/asf/kibana_source/kibana/node_modules/hapi/lib/request.js:263:62)
Also i see that there is a "newPlatform" for plugins. Found some plugins at https://github.com/elastic/kibana/tree/v7.6.1/src/plugins. But I didn't find any public documentation for developing plugins on the "newPlatform". Are any available? Also kbn-plugin-generator still generates "legacy" plugins in v7.6.1 branch (did not checked v7.6.2).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.