# Kibana Plugin persist config

**URL:** <https://discuss.elastic.co/t/kibana-plugin-persist-config/233195>\
**Category:** Kibana\
**Created:** [May 18, 2020, 8:20pm UTC](https://discuss.elastic.co/t/kibana-plugin-persist-config/233195 "2020-05-18T20:20:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![McKittrick\_Kaminski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mckittrick_kaminski/32/59595_2.png) [@McKittrick\_Kaminski](https://discuss.elastic.co/u/McKittrick_Kaminski)\
**Post date:** [May 18, 2020, 8:20pm UTC](https://discuss.elastic.co/t/kibana-plugin-persist-config/233195/1 "2020-05-18T20:20:03Z")

</div>

I'm making a Kibana plugin, and I want to use the config built into Kibana instead of trying to handle things downstream in my plugin. My intention is to be able to set a few variables, and have them persist across reboots, and across clustered kibana instances. Here's how I'm doing it.

```auto
// myPlugin's index.js
  return new kibana.Plugin({
// skipping for brevity
    config(Joi) {
      return Joi.object({
        enabled: Joi.boolean().default(true),
        gcpStorageKey: Joi.string().optional(),
      }).default();
    },
// skipping more
}

```

Later, I'm setting my config by doing:

```auto
const setKey = (key: string): void => {
  const conf = server.config(); // *server* defined elsewhere in file
  conf.set('myPlugin.gcpStorageKey', key);
}

```

Later later, reading it with:

```auto
const init = (): void => {
  const conf = server.config();
  const key = conf.get('myPlugin.gcpStorageKey'); // <- works just fine, unless I restart kibana
  // ... using the key
}

```

Is the `server.config()` supposed to persist changes to the config? Is this only happening because I'm using the development server, and not the permanent one?

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![lukeelmers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukeelmers/32/35230_2.png) [@lukeelmers](https://discuss.elastic.co/u/lukeelmers)\
**Post date:** [May 18, 2020, 9:32pm UTC](https://discuss.elastic.co/t/kibana-plugin-persist-config/233195/2 "2020-05-18T21:32:35Z")

</div>

Hi @McKittrick_Kaminski,

Calling `config.set` will override the configuration setting at runtime, but it will not persist those settings across reboots.

Each time Kibana starts, the bootstrap process will read [the settings](https://www.elastic.co/guide/en/kibana/current/settings.html) out of the `config/kibana.yml` file and override them with any settings explicitly provided as CLI args when starting the Kibana server.

Subsequent calls to `config.set` only persist the changes in memory until the next time the server is started.

To ensure the value is always set, you'll need to include the `myPlugin.gcpStorageKey: abc123` in your `kibana.yml` for each of those instances, or alternatively provide them via the CLI when starting Kibana, `--myPlugin.gcpStorageKey=abc123`.

Thanks,

Luke

---

<div class="post-metadata">

**Author:** ![McKittrick\_Kaminski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mckittrick_kaminski/32/59595_2.png) [@McKittrick\_Kaminski](https://discuss.elastic.co/u/McKittrick_Kaminski)\
**Post date:** [May 19, 2020, 3:16pm UTC](https://discuss.elastic.co/t/kibana-plugin-persist-config/233195/3 "2020-05-19T15:16:29Z")

</div>

Thanks! That clears up a lot!

---

<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 16, 2020, 3:16pm UTC](https://discuss.elastic.co/t/kibana-plugin-persist-config/233195/4 "2020-06-16T15:16:31Z")

</div>

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