Infinity data source - Grafana meta data header not working via yml

Hi everyone,

I’m trying to provision a datasource via YAML with dynamic headers (like explained here URL | Grafana Plugins documentation ), but it works only when configured via the GUI and not via YAML.

The part of my datasource yml file:

- name: infinity
type: yesoreyeram-infinity-datasource
url: "http://example.com/"
isDefault: false
basicAuth: false
jsonData:
httpHeaderName1: "user_email"
secureJsonData:
httpHeaderValue1: ${__user.email}

The value remains empty in the header. When doing the same manually via the GUI, it is working. Checking the grafana database, I see that there is an encrypted value for httpHeaderValue1, even for the YAML case.

When I query the data source via the API, I get the following for the one created via the GUI:

jsonData:
httpHeaderName1: "user_email"
secureJsonFields:
httpHeaderValue1: true

When querying the provisioned data source, I get either no secureJsonFields at all, when doing ‘httpHeaderValue1: ${__user.email}’ in the YAML file

jsonData:
httpHeaderName1: "user_email"
secureJsonFields:

Or the same “true” (but still no value in the header), when doing ‘httpHeaderValue1: “${__user.email}”’ in the YAML file

jsonData:
httpHeaderName1: "user_email"
secureJsonFields:
httpHeaderValue1: true

I guess it should be secureJsonData. Try that, pls.

1 Like

check docu also

The “secureJsonFields” is just the output of the HTTP API. The datasource.yml has jsonData and secureJsonData. In general, static strings are working via the datasource.yml, just not these meta data / variables.

Thank you, I exactly did this Provisioning | Grafana Plugins documentation and URL | Grafana Plugins documentation

Like shown above, I tried in the YAML file the following and tried with and without ‘, “, |, <<>> around the variable.

jsonData:
httpHeaderName1: "user_email"
secureJsonData:
httpHeaderValue1: ${__user.email}

1 Like

Double $$? Provision Grafana | Grafana documentation

1 Like

Yes, $$ is working. Thank you, Sriram.