grafana-json-datasource icon indicating copy to clipboard operation
grafana-json-datasource copied to clipboard

Unable to setup datasource with basic auth

Open AxelAli opened this issue 2 years ago • 1 comments

I have a grafana instance in docker, i will for datasources to be added from a yml file. All my other datasources work but i am unable to provide credentials

My datasource

  - access: "proxy"
    name: "rabbitmq"
    org_id: 1
    type: "marcusolsson-json-datasource"
    url: "rabbitmq:15672"
    version: 1

    basicAuth: true
    withCredentials: true #Tried without and still have an issue
    basicAuthUser: myuser
    basicAuthPassword: andpassword.$STAGE
    editable: true

also attempted


    secureJsonData:
      basicAuthPassword: andpassword.$STAGE

But after creation auth is still disabled

Screen Shot 0004-07-22 at 16 16 31

AxelAli avatar Jul 22 '22 19:07 AxelAli

Hello,

The bug is still around, I have the following YAML file and it doesn't work either after following the general provision guidelines:

---
apiversion: 2
datasources:
  - name: "My JSON datasource"
    type: marcusolsson-json-datasource
    url: https://example.com:443/api/endpoint
    basicAuth: true
    basicAuthUser: "user"
    isDefault: false
    editable: true
    version: 9
    secureJsonData:
      basicAuthPassword: "password"

So the datasource gets provisioned and the only way to fix it is to make it editable so you can change the credentials after it gets created.

I was looking at the code but could not find anything that hints how to hint the provisioning about the right credentials.

jnunezgts avatar Mar 15 '23 15:03 jnunezgts