Skip to content

Commit

Permalink
Check for non-nil ssl port on Poxa.start/2
Browse files Browse the repository at this point in the history
  • Loading branch information
edgurgel committed Jul 10, 2015
1 parent 3216a2c commit c013c02
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/poxa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ defmodule Poxa do
case Application.fetch_env(:poxa, :ssl) do
{:ok, ssl_config} ->
if Enum.all?([:port, :certfile, :keyfile], &Keyword.has_key?(ssl_config, &1)) do
{:ok, _} = :cowboy.start_https(:https, 100,
ssl_config,
[env: [dispatch: dispatch] ])
ssl_port = Keyword.get(ssl_config, :port)
Logger.info "Starting Poxa using SSL on port #{ssl_port}"
if ssl_port do
{:ok, _} = :cowboy.start_https(:https, 100, ssl_config, [env: [dispatch: dispatch] ])
Logger.info "Starting Poxa using SSL on port #{ssl_port}"
else
Logger.info "SSL not configured/started"
end
else
Logger.error "Must specify port, certfile and keyfile (cacertfile optional)"
end
Expand Down

0 comments on commit c013c02

Please sign in to comment.