Altinity / clickhouse-grafana

Altinity Grafana datasource plugin for ClickHouse®
MIT License
720 stars 120 forks source link

Documentation: Fix the structure of yaml [Configure the Datasource with Provisioning] #452

Closed mrlexor closed 2 years ago

mrlexor commented 2 years ago

Hello,

In the current repo and in Grafana docs you have different example of describing datasource via yaml.

It is example from Grafana docs:

apiVersion: 1
datasources:

name: Clickhouse
type: vertamedia-clickhouse-datasource
access: proxy
url: http://localhost:8123
<bool> enable/disable basic auth
basicAuth:
<string> basic auth username
basicAuthUser:
<string> basic auth password
basicAuthPassword:
<bool> enable/disable with credentials headers
withCredentials:
<bool> mark as default datasource. Max one per org
isDefault:
<map> fields that will be converted to json and stored in json_data
jsonData:
<bool> enable/disable sending ‘add_http_cors_header=1’ parameter
addCorsHeader:
<bool> enable/disable using POST method for sending queries
usePOST:
<string> default database name
defaultDatabase:

Where I see mistakes about basicAuthPassword and usePOST.

basicAuthPassword must be placed inside the secureJsonData while usePOST inside the jsonData dictionaries.

Almost the same mistake also you have in README.md:

apiVersion: 1

datasources:
 - name: Clickhouse
   type: vertamedia-clickhouse-datasource
   access: proxy
   url: http://localhost:8123

   # <bool> enable/disable basic auth
   basicAuth:
   # <string> basic auth username
   basicAuthUser:
   # <string> basic auth password
   basicAuthPassword:
   # <bool> enable/disable with credentials headers
   withCredentials:
   # <bool> mark as default datasource. Max one per org
   isDefault:
   # <map> fields that will be converted to json and stored in json_data
   jsonData:
      # <bool> enable/disable sending 'add_http_cors_header=1' parameter
      addCorsHeader:
      # <bool> enable/disable using POST method for sending queries
      usePOST:
      # <string> default database name
      defaultDatabase:

Here you just need to move basicAuthPassword inside the secureJsonData dictionary. At the end in both places you need to describe the following structure for well working datasource provisioning:

- name: "Clickhouse"
  type: vertamedia-clickhouse-datasource
  uid: clickhouse
  url: http://host:port
  basicAuth: true
  withCredentials: true
  basicAuthUser: "username"
  secureJsonData:
    basicAuthPassword: "password"
  jsonData:
    usePOST: true
    addCorsHeader: ""
    defaultDatabase: ""

Here and here you can find the proofs.

Slach commented 2 years ago

Thanks for reporting, Don't hesitate to make pull request to ReadMe.md