# Global plugin var (BOOL) for server and hack

**URL:** <https://discuss.elastic.co/t/global-plugin-var-bool-for-server-and-hack/86303>\
**Category:** Kibana\
**Created:** [May 18, 2017, 4:02pm UTC](https://discuss.elastic.co/t/global-plugin-var-bool-for-server-and-hack/86303 "2017-05-18T16:02:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ENG618](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eng618/32/59206_2.png) [@ENG618](https://discuss.elastic.co/u/ENG618)\
**Post date:** [May 18, 2017, 4:02pm UTC](https://discuss.elastic.co/t/global-plugin-var-bool-for-server-and-hack/86303/1 "2017-05-18T16:02:37Z")

</div>

# Overview

I'm have kibana running in different environments (lets call them **A** and **B** ) and have some plugins that only need to be ran in env **A**. I need to be able to set a `BOOL` that I can access in both the **server config** object and the the **hack.js** file.

## What I have so far:

I have a `BOOL` that is being sent from the startup script and am able to set it in the server config and access it in all the server **index.js** files in my plugins.

## What I need:

I'm trying to find a way to access this same `BOOL` in the **hack.js** files in various plugins. Not sure if there is a better way to handle this, or if there is a way to access or pass that `BOOL` to the **hack.js**

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [May 26, 2017, 2:21pm UTC](https://discuss.elastic.co/t/global-plugin-var-bool-for-server-and-hack/86303/2 "2017-05-26T14:21:17Z")

</div>

Based on your description, I'm assuming your `hack.js` file lives on the client-side. In your plugin configuration where you define your `uiExports`, try defining:

```auto
uiExports.injectDefaultVars = function(server) {
  const config = server.config();
  return {
    BOOL: config.get('BOOL')
  };
}

```

Then in your `hack.js`, you can just inject `BOOL` as a dependency, just like you inject other Angular dependencies.

Hope that helps,

Shaunak

---

<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:** [June 23, 2017, 2:22pm UTC](https://discuss.elastic.co/t/global-plugin-var-bool-for-server-and-hack/86303/3 "2017-06-23T14:22:24Z")

</div>

Closed on June 23, 2017, 2:22pm UTC

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