From 037c9b8d6a192e1a87c1a6ffcc559b10052476d8 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Wed, 16 Apr 2025 14:25:07 +0800 Subject: [PATCH 1/4] docs: add documentation on chanenl_name identifier, closes #18 --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c1a2847..bc10de8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ by adding `libcluster_postgres` to your list of dependencies in `mix.exs`: ```elixir def deps do - [{:libcluster_postgres, "~> 0.1"}] + [ + {:libcluster_postgres, "~> 0.1"} + ] end ``` @@ -45,6 +47,7 @@ config :libcluster, # optional, please refer to the Postgrex docs socket_options: nil, # optional, defaults to node cookie + # must be a valid postgres identifier (alphanumeric and underscores only) with valid length channel_name: "cluster" ], ] From 22cec96aafebef374a844cc0051a8ef9edd35832 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Wed, 16 Apr 2025 14:27:12 +0800 Subject: [PATCH 2/4] docs: add :heartbeat_interval docs --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bc10de8..7294086 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,9 @@ config :libcluster, socket_options: nil, # optional, defaults to node cookie # must be a valid postgres identifier (alphanumeric and underscores only) with valid length - channel_name: "cluster" + channel_name: "cluster", + # optional, heartbeat interval in ms. defaults to 5s + heartbeat_interval: 10_000 ], ] ] From f5cbeb8eb3e0c440d5b061443c12f52e73d63a30 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Wed, 16 Apr 2025 14:27:56 +0800 Subject: [PATCH 3/4] chore: version bump --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 5f29689..be837f2 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule LibclusterPostgres.MixProject do [ name: "libcluster_postgres", app: :libcluster_postgres, - version: "0.1.2", + version: "0.1.3", elixir: "~> 1.14", start_permanent: Mix.env() == :prod, deps: deps(), From ceba4c37d5e0b7a3d2dab3f3bd2e51124946c4ca Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Thu, 17 Apr 2025 14:36:44 +0800 Subject: [PATCH 4/4] feat: make connection parameters optional --- README.md | 3 ++- lib/strategy.ex | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7294086..69e66d3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# libcluster Postgres Strategy +# Libcluster Postgres Strategy [![Hex version badge](https://img.shields.io/hexpm/v/libcluster_postgres.svg)](https://hex.pm/packages/libcluster_postgres) [![License badge](https://img.shields.io/hexpm/l/libcluster_postgres.svg)](https://github.com/supabase/libcluster_postgres/blob/main/LICENSE) @@ -39,6 +39,7 @@ config :libcluster, password: "postgres", database: "postgres", port: 5432, + # optional, connection parameters. Defaults to [] parameters: [], # optional, defaults to false ssl: true, diff --git a/lib/strategy.ex b/lib/strategy.ex index 3adb48c..bff79e5 100644 --- a/lib/strategy.ex +++ b/lib/strategy.ex @@ -35,7 +35,7 @@ defmodule LibclusterPostgres.Strategy do ssl: Keyword.get(state.config, :ssl), ssl_opts: Keyword.get(state.config, :ssl_opts), socket_options: Keyword.get(state.config, :socket_options, []), - parameters: Keyword.fetch!(state.config, :parameters), + parameters: Keyword.get(state.config, :parameters, []), channel_name: channel_name ]