@@ -18,6 +18,9 @@ defmodule LibclusterPostgres.Strategy do
1818 alias Cluster.Strategy
1919 alias Cluster.Logger
2020
21+ @ postgrex_keys [ :hostname , :username , :password , :database , :port ] ++
22+ [ :ssl , :ssl_opts , :socket , :socket_dir , :socket_options , :parameters ]
23+
2124 def start_link ( args ) , do: GenServer . start_link ( __MODULE__ , args )
2225
2326 @ spec init ( [ % { :config => any ( ) , :meta => any ( ) , optional ( any ( ) ) => any ( ) } , ... ] ) ::
@@ -26,18 +29,9 @@ defmodule LibclusterPostgres.Strategy do
2629 def init ( [ state ] ) do
2730 channel_name = Keyword . get ( state . config , :channel_name , clean_cookie ( Node . get_cookie ( ) ) )
2831
29- opts = [
30- hostname: Keyword . fetch! ( state . config , :hostname ) ,
31- username: Keyword . fetch! ( state . config , :username ) ,
32- password: Keyword . fetch! ( state . config , :password ) ,
33- database: Keyword . fetch! ( state . config , :database ) ,
34- port: Keyword . fetch! ( state . config , :port ) ,
35- ssl: Keyword . get ( state . config , :ssl ) ,
36- ssl_opts: Keyword . get ( state . config , :ssl_opts ) ,
37- socket_options: Keyword . get ( state . config , :socket_options , [ ] ) ,
38- parameters: Keyword . get ( state . config , :parameters , [ ] ) ,
39- channel_name: channel_name
40- ]
32+ opts =
33+ [ channel_name: channel_name ] ++
34+ Keyword . take ( state . config , @ postgrex_keys )
4135
4236 config =
4337 state . config
0 commit comments