Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward all Opts to SSL config #106

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/elli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,20 @@ init([Opts]) ->
MinAcceptors = proplists:get_value(min_acceptors, Opts, 20),

UseSSL = proplists:get_value(ssl, Opts, false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the test is failing on this boolean.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't fail as a result of my change, maybe something else?

KeyFile = proplists:get_value(keyfile, Opts),
CertFile = proplists:get_value(certfile, Opts),
%% KeyFile = proplists:get_value(keyfile, Opts),
%% CertFile = proplists:get_value(certfile, Opts),
SockType = ?IF(UseSSL, ssl, plain),
%% Pass all the supplied Opts, Erlang SSL will pick out only
%% what it needs / understands. Don't discard other options user intends to pass for SSL config
%% Sanitize Opts
Opts1 = proplists:delete(reuseaddr, Opts),
Opts2 = proplists:delete(backlog, Opts1),
Opts3 = proplists:delete(packet, Opts2),
Opts4 = proplists:delete(active, Opts3),
Opts5 = proplists:delete(ssl, Opts4),

SSLSockOpts = ?IF(UseSSL,
[{keyfile, KeyFile}, {certfile, CertFile}],
Opts5,
[]),

AcceptTimeout = proplists:get_value(accept_timeout, Opts, 10000),
Expand Down