Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): pass GRAFANA_TOKEN env variable on Grafana initialization #20

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading