Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Postgres socket authentication (#1052)

Maximilian Bosch4ff25f68c89a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d2a0477332..16c4172d58 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
- New parameter `metrics` for the `/api/v1/stats/timeseries` endpoint plausible/analytics#952
- CSV export now includes pageviews, bounce rate and visit duration in addition to visitors plausible/analytics#952
- Send stats to multiple dashboards by configuring a comma-separated list of domains plausible/analytics#968
+- To authenticate against a local postgresql via socket authentication, the environment-variables
+ `DATABASE_SOCKET_DIR` & `DATABASE_NAME` were added.
- Time on Page metric available in detailed Top Pages report plausible/analytics#1007
- Glob (wildcard) based page, entry page and exit page filters plausible/analytics#1067
- Exclusion filters for page, entry page and exit page filters plausible/analytics#1067
diff --git a/config/runtime.exs b/config/runtime.exs
index 4b2e30f854..78336643ff 100644
--- a/config/runtime.exs
+++ b/config/runtime.exs
@@ -109,7 +109,15 @@ config :plausible, PlausibleWeb.Endpoint,
http: [port: port],
secret_key_base: secret_key_base
-config :plausible, Plausible.Repo, url: db_url
+case System.get_env("DATABASE_SOCKET_DIR", "") do
+ "" ->
+ config :plausible, Plausible.Repo, url: db_url
+
+ x ->
+ config :plausible, Plausible.Repo,
+ socket_dir: x,
+ database: System.get_env("DATABASE_NAME")
+end
config :sentry,
dsn: sentry_dsn,