@@ -9,12 +9,12 @@ defmodule DBConnection.Connection do
99 alias DBConnection.Util
1010
1111 @ timeout 15_000
12- @ sensitive_opts [ :parameters , :hostname , :port , :username , :password , :database ]
1312
1413 @ doc false
1514 def start_link ( mod , opts , pool , tag ) do
1615 start_opts = Keyword . take ( opts , [ :debug , :spawn_opt ] )
17- :gen_statem . start_link ( __MODULE__ , { mod , opts , pool , tag } , start_opts )
16+ sensitive_options = % DBConnection.SensitiveData { data: opts }
17+ :gen_statem . start_link ( __MODULE__ , { mod , sensitive_options , pool , tag } , start_opts )
1818 end
1919
2020 @ doc false
@@ -48,7 +48,7 @@ defmodule DBConnection.Connection do
4848
4949 @ doc false
5050 @ impl :gen_statem
51- def init ( { mod , opts , pool , tag } ) do
51+ def init ( { mod , % DBConnection.SensitiveData { data: opts } , pool , tag } ) do
5252 pool_index = Keyword . get ( opts , :pool_index )
5353 label = if pool_index , do: "db_conn_#{ pool_index } " , else: "db_conn"
5454 Util . set_label ( label )
@@ -235,7 +235,6 @@ defmodule DBConnection.Connection do
235235 case apply ( mod , :checkout , [ state ] ) do
236236 { :ok , state } ->
237237 opts = [ timeout: timeout ] ++ opts
238- opts = Keyword . drop ( opts , @ sensitive_opts )
239238 { pid , ref } = DBConnection.Task . run_child ( mod , state , after_connect , opts )
240239 timer = start_timer ( pid , timeout )
241240 s = % { s | client: { ref , :after_connect } , timer: timer , state: state }
0 commit comments