Skip to content

Commit fb3b00e

Browse files
TLS listener startup: wrap private key password option into a function
1 parent 49341b7 commit fb3b00e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

deps/rabbit/src/rabbit_networking.erl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,16 @@ start_ssl_listener(Listener, SslOpts, NumAcceptors) ->
282282
-spec start_ssl_listener(
283283
listener_config(), rabbit_types:infos(), integer(), integer()) -> 'ok' | {'error', term()}.
284284

285-
start_ssl_listener(Listener, SslOpts, NumAcceptors, ConcurrentConnsSupsCount) ->
285+
start_ssl_listener(Listener, SslOpts0, NumAcceptors, ConcurrentConnsSupsCount) ->
286+
SslOpts = case proplists:get_value(password, SslOpts0) of
287+
undefined -> SslOpts0;
288+
Password ->
289+
%% A password can be a value or a function returning that value.
290+
%% See the key_pem_password/0 type in https://github.com/erlang/otp/pull/5843/files.
291+
NewOpts = proplists:delete(password, SslOpts0),
292+
Fun = fun() -> Password end,
293+
[{password, Fun} | NewOpts]
294+
end,
286295
start_listener(Listener, NumAcceptors, ConcurrentConnsSupsCount, 'amqp/ssl',
287296
"TLS (SSL) listener", tcp_opts() ++ SslOpts).
288297

0 commit comments

Comments
 (0)