Path for the data source proxy - dynamic base URL?

  • What Grafana version and what operating system are you using?
    Grafana v9.1.7, Windows.

  • What are you trying to achieve?
    For my data source plugin, I have defined a route (in plugin.json file) for the data source proxy:

"routes": [
  {
    "path": "authenticate",
    "url": "http://localhost/api",
    ...

It totally works.

But I cannot guarantee that user’s API URL will always be “http://localhost/api”; users can edit this URL on plugin’s configuration page.

Is there any way I can (dynamically) use configuration’s HTTP URL for the data source proxy URL?

Thank you in advance.

P.S. related feature request: https://github.com/grafana/grafana/discussions/38322

Answering my own question. In plugin.json, write for the route URL:

"url": "{{ .JsonData.url }}",

and, in your configuration editor page, put your API URL in jsonData.

Voila, it works now!