How to store configuration for an app plugin?

Hello,

I am trying to build an App Plugin for Grafana 8 onwards in React and I found the repo with the tutorial and the simple app.

I am having a trouble though and it’s about saving/loading configurations. I tried searching around to find a way to save a configuration in a file or in any place possible but I was not successful (looked into local file as in the plugin directory). I am trying to avoid querying a server or external system for a json with the config.

Which is the recommended way to store a configuration for an app plugin?

If anyone ever needs a little help at this, what I did was:

created a function that sends a post request with the settings as

updatePluginSettings = (settings: { jsonData: unknown; pinned: boolean }): Promise<undefined> => {
        return getBackendSrv().post(`api/plugins/${this.props.plugin.meta.id}/settings`, settings);
      };

Later you can read the settings as:

this.props.plugin.meta.jsonData
1 Like