diff --git a/README.md b/README.md index 51467e1..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,13 +39,19 @@ config :libcluster, password: "postgres", database: "postgres", port: 5432, + # optional, connection parameters. Defaults to [] parameters: [], # optional, defaults to false ssl: true, # optional, please refer to the Postgrex docs ssl_opts: nil, + # 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 25d5dfc..bff79e5 100644 --- a/lib/strategy.ex +++ b/lib/strategy.ex @@ -34,7 +34,8 @@ defmodule LibclusterPostgres.Strategy do port: Keyword.fetch!(state.config, :port), ssl: Keyword.get(state.config, :ssl), ssl_opts: Keyword.get(state.config, :ssl_opts), - parameters: Keyword.fetch!(state.config, :parameters), + socket_options: Keyword.get(state.config, :socket_options, []), + 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(),