storage: implement postgres event query/count filter translation

This commit is contained in:
2026-03-13 20:37:32 +01:00
parent cd1adf94f0
commit 693786615f
6 changed files with 415 additions and 2 deletions

View File

@@ -29,4 +29,6 @@ config :parrhesia,
config :parrhesia, Parrhesia.Web.Endpoint, port: 4000
config :parrhesia, ecto_repos: [Parrhesia.Repo]
import_config "#{config_env()}.exs"

View File

@@ -1,3 +1,25 @@
import Config
config :logger, :console, format: "[$level] $message\n"
pg_host = System.get_env("PGHOST")
repo_host_opts =
if is_binary(pg_host) and String.starts_with?(pg_host, "/") do
[socket_dir: pg_host]
else
[
hostname: pg_host || "localhost",
port: String.to_integer(System.get_env("PGPORT") || "5432")
]
end
config :parrhesia,
Parrhesia.Repo,
[
username: System.get_env("PGUSER") || System.get_env("USER") || "agent",
password: System.get_env("PGPASSWORD"),
database: System.get_env("PGDATABASE") || "parrhesia_dev",
show_sensitive_data_on_connection_error: true,
pool_size: 10
] ++ repo_host_opts

View File

@@ -1 +1,9 @@
import Config
database_url =
System.get_env("DATABASE_URL") ||
raise "environment variable DATABASE_URL is missing. Example: ecto://USER:PASS@HOST/DATABASE"
config :parrhesia, Parrhesia.Repo,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")

View File

@@ -5,3 +5,25 @@ config :logger, level: :warning
config :parrhesia, Parrhesia.Web.Endpoint,
port: 0,
ip: {127, 0, 0, 1}
pg_host = System.get_env("PGHOST")
repo_host_opts =
if is_binary(pg_host) and String.starts_with?(pg_host, "/") do
[socket_dir: pg_host]
else
[
hostname: pg_host || "localhost",
port: String.to_integer(System.get_env("PGPORT") || "5432")
]
end
config :parrhesia,
Parrhesia.Repo,
[
username: System.get_env("PGUSER") || System.get_env("USER") || "agent",
password: System.get_env("PGPASSWORD"),
database: System.get_env("PGDATABASE") || "parrhesia_test",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10
] ++ repo_host_opts