# Access variables in Kibana.yml

**URL:** <https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874>\
**Category:** Kibana\
**Created:** [April 7, 2020, 10:18am UTC](https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874 "2020-04-07T10:18:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiGiLord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gigilord/32/65820_2.png) [@GiGiLord](https://discuss.elastic.co/u/GiGiLord)\
**Post date:** [April 7, 2020, 10:18am UTC](https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874/1 "2020-04-07T10:18:45Z")

</div>

Hi all,

I trying to make changes to kibana core source code and I trying to access the variables in kibana.yml file from my JS file. Example is shown as below:

```
let elastic_url = process.env['elasticsearch.hosts']

```

Would really appreciate if anyone can give some pointers.

Note: I not trying to access from plugins.

---

<div class="post-metadata">

**Author:** ![Liza\_Katz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liza_katz/32/52358_2.png) [@Liza\_Katz](https://discuss.elastic.co/u/Liza_Katz)\
**Post date:** [April 7, 2020, 1:58pm UTC](https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874/2 "2020-04-07T13:58:39Z")

</div>

Hey @GiGiLord

Generally speaking, within the new plugin structure, variables from `kibana.yml` are accessible only on the **server side** by using the plugin context `initializerContext.config` that's passed to the server plugin constructor as the first parameter.

For example, if you look at `src/plugins/data/server/plugin.ts`, it receives an `initializerConfig` parameter. In your own server side plugin you could do `initializerContext.config.get('...')`.

I hope this points you out in the right direction!

---

<div class="post-metadata">

**Author:** ![GiGiLord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gigilord/32/65820_2.png) [@GiGiLord](https://discuss.elastic.co/u/GiGiLord)\
**Post date:** [April 8, 2020, 3:35am UTC](https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874/3 "2020-04-08T03:35:24Z")

</div>

> [@Liza\_Katz](#):
>
> initializerConfig

Hi Liza, Thanks for the prompt reply.

ok, I will try to work on the solution that u give. I assuming the Discover module is also setup and structure like a plugin. Am I correct?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 6, 2020, 3:35am UTC](https://discuss.elastic.co/t/access-variables-in-kibana-yml/226874/4 "2020-05-06T03:35:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
