Skip to content

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

Allow exemption list to be provided in config

Uku Tahtc3b24342c6ad
diff --git a/config/runtime.exs b/config/runtime.exs
index 78821990f5..b35f2b7dcc 100644
--- a/config/runtime.exs
+++ b/config/runtime.exs
@@ -81,6 +81,7 @@ log_level = String.to_existing_atom(System.get_env("LOG_LEVEL", "warn"))
log_format = System.get_env("LOG_FORMAT", "elixir")
is_selfhost = String.to_existing_atom(System.get_env("SELFHOST", "true"))
{site_limit, ""} = Integer.parse(System.get_env("SITE_LIMIT", "20"))
+no_limit_ids = System.get_env("NO_LIMIT_IDS", "") |> String.split(",") |> Enum.map(&String.trim/1)
disable_cron = String.to_existing_atom(System.get_env("DISABLE_CRON", "false"))
{user_agent_cache_limit, ""} = Integer.parse(System.get_env("USER_AGENT_CACHE_LIMIT", "1000"))
@@ -96,6 +97,7 @@ config :plausible,
mailer_email: mailer_email,
admin_emails: admin_emails,
site_limit: site_limit,
+ no_limit_ids: no_limit_ids,
is_selfhost: is_selfhost
config :plausible, :selfhost,
diff --git a/lib/plausible/billing/billing.ex b/lib/plausible/billing/billing.ex
index f24d581ee8..a63703fb94 100644
--- a/lib/plausible/billing/billing.ex
+++ b/lib/plausible/billing/billing.ex
@@ -193,11 +193,14 @@ defmodule Plausible.Billing do
grandfathering old accounts to unlimited websites and ignores site limit on self-hosted
installations.
"""
- @limit_accounts_after ~D[2018-05-04]
+ @limit_accounts_since ~D[2018-05-05]
def sites_limit(user) do
+ no_limit_ids = Application.get_env(:plausible, :no_limit_ids)
+
cond do
- Timex.before?(user.inserted_at, @limit_accounts_after) -> nil
+ Timex.before?(user.inserted_at, @limit_accounts_since) -> nil
Application.get_env(:plausible, :is_selfhost) -> nil
+ user.id in no_limit_ids -> nil
true -> Application.get_env(:plausible, :site_limit)
end
end