Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Change SMTP defaults (#4538)
ruslandoga67d7c6522c54
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c6be775c4c..0af8054c5d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -128,6 +128,8 @@ All notable changes to this project will be documented in this file.- Replace `CLICKHOUSE_MAX_BUFFER_SIZE` with `CLICKHOUSE_MAX_BUFFER_SIZE_BYTES`- Validate metric isn't queried multiple times- Filters in dashboard are represented by jsonurl+- `MAILER_EMAIL` now defaults to an address built off of `BASE_URL` plausible/analytics#4538+- default `MAILER_ADAPTER` has been changed to `Bamboo.Mua` plausible/analytics#4538### Fixed- Creating many sites no longer leads to cookie overflowdiff --git a/config/runtime.exs b/config/runtime.exsindex 4850783d81..16ac1f6310 100644--- a/config/runtime.exs+++ b/config/runtime.exs@@ -99,8 +99,8 @@ super_admin_user_ids =|> Enum.filter(& &1)env = get_var_from_path_or_env(config_dir, "ENVIRONMENT", "prod")-mailer_adapter = get_var_from_path_or_env(config_dir, "MAILER_ADAPTER", "Bamboo.SMTPAdapter")-mailer_email = get_var_from_path_or_env(config_dir, "MAILER_EMAIL", "[email protected]")+mailer_adapter = get_var_from_path_or_env(config_dir, "MAILER_ADAPTER", "Bamboo.Mua")+mailer_email = get_var_from_path_or_env(config_dir, "MAILER_EMAIL", "plausible@#{base_url.host}")mailer_email =if mailer_name = get_var_from_path_or_env(config_dir, "MAILER_NAME") do@@ -536,6 +536,13 @@ case mailer_adapter do"Bamboo.Mua" ->config :plausible, Plausible.Mailer, adapter: Bamboo.Mua+ # prevents common problems with Erlang's TLS v1.3+ middlebox_comp_mode =+ get_var_from_path_or_env(config_dir, "SMTP_MIDDLEBOX_COMP_MODE", "false")++ middlebox_comp_mode = String.to_existing_atom(middlebox_comp_mode)+ config :plausible, Plausible.Mailer, ssl: [middlebox_comp_mode: middlebox_comp_mode]+if relay = get_var_from_path_or_env(config_dir, "SMTP_HOST_ADDR") doport = get_int_from_path_or_env(config_dir, "SMTP_HOST_PORT", 25)config :plausible, Plausible.Mailer, relay: relay, port: portdiff --git a/test/plausible/config_test.exs b/test/plausible/config_test.exsindex 75da84bd79..920b0d58e1 100644--- a/test/plausible/config_test.exs+++ b/test/plausible/config_test.exs@@ -4,7 +4,14 @@ defmodule Plausible.ConfigTest dodescribe "mailer" dotest "mailer email default" doenv = [{"MAILER_EMAIL", nil}]- assert get_in(runtime_config(env), [:plausible, :mailer_email]) == "[email protected]"+ assert get_in(runtime_config(env), [:plausible, :mailer_email]) == "plausible@localhost"+ end++ test "mailer email from base url" do+ env = [{"MAILER_EMAIL", nil}, {"BASE_URL", "https://plausible.example.com:8443"}]++ assert get_in(runtime_config(env), [:plausible, :mailer_email]) ==endtest "mailer email custom" do@@ -16,7 +23,7 @@ defmodule Plausible.ConfigTest doenv = [{"MAILER_EMAIL", nil}, {"MAILER_NAME", "John"}]assert get_in(runtime_config(env), [:plausible, :mailer_email]) ==- {"John", "[email protected]"}+ {"John", "plausible@localhost"}env = [{"MAILER_EMAIL", "[email protected]"}, {"MAILER_NAME", "John"}]@@ -24,21 +31,12 @@ defmodule Plausible.ConfigTest do{"John", "[email protected]"}end- test "defaults to Bamboo.SMTPAdapter" do+ test "defaults to Bamboo.Mua" doenv = {"MAILER_ADAPTER", nil}assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [- adapter: Bamboo.SMTPAdapter,- server: "mail",- hostname: "localhost",- port: "25",- username: nil,- password: nil,- tls: :if_available,- allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],- ssl: false,- retries: 2,- no_mx_lookups: true+ adapter: Bamboo.Mua,+ ssl: [middlebox_comp_mode: false]]end@@ -144,7 +142,17 @@ defmodule Plausible.ConfigTest doenv = [{"MAILER_ADAPTER", "Bamboo.Mua"}]assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [- {:adapter, Bamboo.Mua}+ {:adapter, Bamboo.Mua},+ {:ssl, [middlebox_comp_mode: false]}+ ]+ end++ test "Bamboo.Mua (middlebox_comp_mode enabled)" do+ env = [{"MAILER_ADAPTER", "Bamboo.Mua"}, {"SMTP_MIDDLEBOX_COMP_MODE", "true"}]++ assert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [+ {:adapter, Bamboo.Mua},+ {:ssl, [middlebox_comp_mode: true]}]end@@ -159,6 +167,7 @@ defmodule Plausible.ConfigTest doassert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [{:adapter, Bamboo.Mua},+ {:ssl, [middlebox_comp_mode: false]},{:relay, "localhost"},{:port, 2525},{:auth, [username: "neo", password: "one"]}@@ -176,6 +185,7 @@ defmodule Plausible.ConfigTest doassert get_in(runtime_config(env), [:plausible, Plausible.Mailer]) == [adapter: Bamboo.Mua,+ ssl: [middlebox_comp_mode: false],relay: "localhost",port: 2525]