Skip to content

Commit

Permalink
Add missing Umami Analytics config logic update
Browse files Browse the repository at this point in the history
  • Loading branch information
questionlp committed Sep 12, 2024
1 parent 4bbeb13 commit 639b7da
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changes

## 3.0.2

### Application Notes

- Add missing Umami Analytics config logic update

## 3.0.1

### Application Notes
Expand Down
5 changes: 1 addition & 4 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ def create_app():
app.jinja_env.globals["ga_property_code"] = _config["settings"].get(
"ga_property_code", ""
)
umami = _config["settings"].get("umami_analytics", None)
app.jinja_env.globals["umami_analytics"] = format_umami_analytics(
umami_analytics=umami
)
app.jinja_env.globals["umami"] = _config["settings"]["umami"]
app.jinja_env.globals["api_url"] = _config["settings"].get("api_url", "")
app.jinja_env.globals["blog_url"] = _config["settings"].get("blog_url", "")
app.jinja_env.globals["repo_url"] = _config["settings"].get("repo_url", "")
Expand Down
18 changes: 18 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ def load_config(
settings_config["time_zone"] = time_zone_string
database_config["time_zone"] = time_zone_string

# Read in Umami Analytics settings
if "umami_analytics" in settings_config:
_umami = dict(settings_config["umami_analytics"])
settings_config["umami"] = {
"enabled": bool(_umami.get("enabled", False)),
"url": _umami.get("url"),
"website_id": _umami.get("data_website_id"),
"auto_track": bool(_umami.get("data_auto_track", True)),
"host_url": _umami.get("data_host_url"),
"domains": _umami.get("data_domains"),
}

del settings_config["umami_analytics"]
else:
settings_config["umami"] = {
"enabled": False,
}

return {
"database": database_config,
"settings": settings_config,
Expand Down
2 changes: 1 addition & 1 deletion app/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# vim: set noai syntax=python ts=4 sw=4:
"""Application Version for Wait Wait Graphs Site."""

APP_VERSION = "3.0.1"
APP_VERSION = "3.0.2"

0 comments on commit 639b7da

Please sign in to comment.