From 13424d364431502394286b647ecdbe49962af349 Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Tue, 7 May 2024 17:17:22 +0700 Subject: [PATCH] add support for DATABASE_SEARCH_PATH --- config/runtime.exs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/runtime.exs b/config/runtime.exs index 9cebd88ade99..790e3b741b69 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -318,6 +318,7 @@ config :plausible, PlausibleWeb.Endpoint, maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: [] db_cacertfile = get_var_from_path_or_env(config_dir, "DATABASE_CACERTFILE", CAStore.file_path()) +db_search_path = get_var_from_path_or_env(config_dir, "DATABASE_SEARCH_PATH") if is_nil(db_socket_dir) do config :plausible, Plausible.Repo, @@ -336,6 +337,11 @@ else database: get_var_from_path_or_env(config_dir, "DATABASE_NAME", "plausible") end +if db_search_path do + config :plausible, Plausible.Repo, + after_connect: {Postgrex, :query!, ["SET search_path TO #{db_search_path}", []]} +end + sentry_app_version = runtime_metadata[:version] || app_version config :sentry,