Merge pull request #205 from maiha/without_openssl

Disable ssl when `-D without_openssl` is given
This commit is contained in:
Serdar Dogruyol 2016-09-16 22:35:37 +03:00 committed by GitHub
commit 94217a1564
3 changed files with 8 additions and 0 deletions

View file

@ -12,7 +12,9 @@ module Kemal
config.add_handler Kemal::RouteHandler::INSTANCE
config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers)
{% if ! flag?(:without_openssl) %}
config.server.tls = config.ssl
{% end %}
Kemal::Sessions.run_reaper!

View file

@ -39,6 +39,7 @@ module Kemal
end
def configure_ssl
{% if ! flag?(:without_openssl) %}
if @ssl_enabled
puts "SSL Key Not Found"; exit unless @key_file
puts "SSL Certificate Not Found"; exit unless @cert_file
@ -47,6 +48,7 @@ module Kemal
ssl.set_cert_file @cert_file.not_nil!
Kemal.config.ssl = ssl.context
end
{% end %}
end
def read_env

View file

@ -8,7 +8,11 @@ module Kemal
INSTANCE = Config.new
HANDLERS = [] of HTTP::Handler
ERROR_HANDLERS = {} of Int32 => HTTP::Server::Context -> String
{% if flag?(:without_openssl) %}
@ssl : Bool?
{% else %}
@ssl : OpenSSL::SSL::Context::Server?
{% end %}
property host_binding, ssl, port, env, public_folder, logging,
always_rescue, serve_static, server, extra_options