diff --git a/README.md b/README.md index c1a2847..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) @@ -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 ``` @@ -37,6 +39,7 @@ config :libcluster, password: "postgres", database: "postgres", port: 5432, + # optional, connection parameters. Defaults to [] parameters: [], # optional, defaults to false ssl: true, @@ -45,7 +48,10 @@ config :libcluster, # optional, please refer to the Postgrex docs socket_options: nil, # optional, defaults to node cookie - channel_name: "cluster" + # must be a valid postgres identifier (alphanumeric and underscores only) with valid length + channel_name: "cluster", + # optional, heartbeat interval in ms. defaults to 5s + heartbeat_interval: 10_000 ], ] ] 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 ] 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(),