Add Socket SSL column to management UI

This commit is contained in:
Razvan Grigore 2025-04-26 19:16:25 +03:00 committed by Michael Klishin
parent 55dc63a801
commit 09c546a1c8
No known key found for this signature in database
GPG Key ID: 16AB14D00D613900
2 changed files with 12 additions and 1 deletions

View File

@ -252,6 +252,7 @@
<% } %> <% } %>
<th>Bound to</th> <th>Bound to</th>
<th>Port</th> <th>Port</th>
<th>SSL</th>
</tr> </tr>
<% <%
for (var i = 0; i < overview.listeners.length; i++) { for (var i = 0; i < overview.listeners.length; i++) {
@ -264,6 +265,7 @@
<% } %> <% } %>
<td><%= listener.ip_address %></td> <td><%= listener.ip_address %></td>
<td><%= listener.port %></td> <td><%= listener.port %></td>
<td class="c"><%= fmt_boolean(listener.ssl || false) %></td>
</tr> </tr>
<% } %> <% } %>
</table> </table>

View File

@ -279,13 +279,22 @@ listener(#listener{node = Node, protocol = Protocol,
{protocol, Protocol}, {protocol, Protocol},
{ip_address, ip(IPAddress)}, {ip_address, ip(IPAddress)},
{port, Port}, {port, Port},
{socket_opts, format_socket_opts(Opts)}]. {socket_opts, format_socket_opts(Opts)},
{ssl, is_ssl_socket(Opts)}
].
web_context(Props0) -> web_context(Props0) ->
SslOpts = pget(ssl_opts, Props0, []), SslOpts = pget(ssl_opts, Props0, []),
Props = proplists:delete(ssl_opts, Props0), Props = proplists:delete(ssl_opts, Props0),
[{ssl_opts, format_socket_opts(SslOpts)} | Props]. [{ssl_opts, format_socket_opts(SslOpts)} | Props].
is_ssl_socket(Opts) ->
S = proplists:get_value(socket_opts, Opts, Opts),
(proplists:get_value(ssl_opts, S, undefined) =/= undefined) orelse
(proplists:get_value(cacertfile, S, undefined) =/= undefined) orelse
(proplists:get_value(certfile, S, undefined) =/= undefined) orelse
(proplists:get_value(keyfile, S, undefined) =/= undefined).
format_socket_opts(Opts) -> format_socket_opts(Opts) ->
format_socket_opts(Opts, []). format_socket_opts(Opts, []).