Skip to content

Commit

Permalink
fix(auth): pass GRAFANA_TOKEN env variable on Grafana initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jl2397 authored and amotl committed Oct 3, 2024
1 parent aa60253 commit fbdbc55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
JSON.
* Add watchdog feature, monitoring the input dashboard for changes on
disk, and re-uploading it, when changed.
* Pass `GRAFANA_TOKEN` environment variable on Grafana initialization.
Thanks, @jl2397.

## 0.2.0 (2022-02-05)
* Migrated from grafana_api to grafana_client
Expand Down
5 changes: 4 additions & 1 deletion grafana_import/grafana.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import traceback
import typing as t
Expand Down Expand Up @@ -65,7 +66,9 @@ def __init__(self, **kwargs):

# Configure Grafana connectivity.
if "url" in kwargs:
self.grafana_api = GrafanaApi.GrafanaApi.from_url(kwargs["url"])
self.grafana_api = GrafanaApi.GrafanaApi.from_url(
url=kwargs["url"], credential=os.environ.get("GRAFANA_TOKEN")
)
else:
config = {}
config["protocol"] = kwargs.get("protocol", "http")
Expand Down

0 comments on commit fbdbc55

Please sign in to comment.