How to access kibana.yml parameters in Custom Kibana Plugin 7.10.0

Holla !

  • I am using 7.10.0 version of kibana and I need to access kibana.yml's parameters in custom Plugin (consisting backend and frontend).

plugin.ts

constructor(initializerContext: PluginInitializerContext) {
    this.logger = initializerContext.logger.get();
    this.environmentConfig = initializerContext.env;
  }

  public setup(core: CoreSetup<AividInsightsPluginStartDeps>, deps: AividInsightsPluginSetupDeps) {
    this.logger.debug('aividInsights: Setup');
    const router = core.http.createRouter();

    core.getStartServices().then(([_, depsStart]) => {
      // console.log(_, depsStart, this.environmentConfig);

      const serverConfigData = {
        esClient: _.elasticsearch.client,
        //@ts-ignore
        esHosts: _.elasticsearch.client.config.hosts,
        //@ts-ignore
        additionBasePath: _.http.basePath.get(),
        ..._.http.getServerInfo(),
        environmentConfig: this.environmentConfig,
        IS_SERVER_LIVE: this.environmentConfig.mode.prod,
        NODE_JS_BASE_URL: this.environmentConfig.mode.prod
          ? PROD_NODE_JS_BASE_URL
          : OVERWRITE_DEV_JS_BASE_URL ||
            //@ts-ignore
            `${_.elasticsearch.client.config.hosts?.[0]
              ?.slice(0, -6)
              .replace('http:', 'https:')}:32000`,
      };
      registerRoutes(router, depsStart.data, this.logger, serverConfigData);
    });

    return {};
  }

I tried using the given parameters of plugins (intializerContext, core, deps) but I still have not found yml variables.
Is there any variable available that consists the parameters of yml.
I want to access server.ssl.enabled , server.ssl.certificate , server.ssl.key , server.name

Hi @Hackwithharshil and welcome to the community!

Kibana configuration is accessible through the initializerContext.config API.
You should also be able to access the configuration from the plugin that registers the settings if you add that plugin as a dependency to yours.

It's challenging to provide the exact code to suit your needs but a great place to start is to look at the examples given for how to use config in the Kibana platform.

You'll also find other examples in Kibana's code in the x-pack plugins folder.

I hope that helps!