Skip to content

Commit

Permalink
Folder Import: Fix software tests. Add change log item.
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 10, 2024
1 parent c3ad715 commit aeece73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# History

## Unreleased
- Fixed folder argument issue
- Fixed import dashboards into a folder

Thanks, @vrymar.

## 0.3.0 (2024-10-03)
* Permit invocation without configuration file for ad hoc operations.
Expand Down
22 changes: 12 additions & 10 deletions grafana_import/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,21 @@ def grafana_settings(

# Grafana connectivity.
if url or "GRAFANA_URL" in os.environ:
params = {"url": url or os.environ["GRAFANA_URL"]}
if "GRAFANA_TOKEN" in os.environ:
params.update({"token": os.environ["GRAFANA_TOKEN"]})
elif config is not None:
params.update({"url": url or os.environ["GRAFANA_URL"]})
if "GRAFANA_TOKEN" in os.environ:
params.update({"token": os.environ["GRAFANA_TOKEN"]})

if not params and config is not None and label is not None:
params = grafana_settings_from_config_section(config=config, label=label)

# Additional application parameters.
params.update(
{
"search_api_limit": config.get("grafana", {}).get("search_api_limit", 5000),
"folder": config.get("general", {}).get("grafana_folder", "General"),
}
)
if config is not None:
params.update(
{
"search_api_limit": config.get("grafana", {}).get("search_api_limit", 5000),
"folder": config.get("general", {}).get("grafana_folder", "General"),
}
)
return params


Expand Down

0 comments on commit aeece73

Please sign in to comment.