mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Merge pull request #205 from maiha/without_openssl
Disable ssl when `-D without_openssl` is given
This commit is contained in:
commit
94217a1564
3 changed files with 8 additions and 0 deletions
|
@ -12,7 +12,9 @@ module Kemal
|
||||||
config.add_handler Kemal::RouteHandler::INSTANCE
|
config.add_handler Kemal::RouteHandler::INSTANCE
|
||||||
|
|
||||||
config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers)
|
config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers)
|
||||||
|
{% if ! flag?(:without_openssl) %}
|
||||||
config.server.tls = config.ssl
|
config.server.tls = config.ssl
|
||||||
|
{% end %}
|
||||||
|
|
||||||
Kemal::Sessions.run_reaper!
|
Kemal::Sessions.run_reaper!
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ module Kemal
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_ssl
|
def configure_ssl
|
||||||
|
{% if ! flag?(:without_openssl) %}
|
||||||
if @ssl_enabled
|
if @ssl_enabled
|
||||||
puts "SSL Key Not Found"; exit unless @key_file
|
puts "SSL Key Not Found"; exit unless @key_file
|
||||||
puts "SSL Certificate Not Found"; exit unless @cert_file
|
puts "SSL Certificate Not Found"; exit unless @cert_file
|
||||||
|
@ -47,6 +48,7 @@ module Kemal
|
||||||
ssl.set_cert_file @cert_file.not_nil!
|
ssl.set_cert_file @cert_file.not_nil!
|
||||||
Kemal.config.ssl = ssl.context
|
Kemal.config.ssl = ssl.context
|
||||||
end
|
end
|
||||||
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_env
|
def read_env
|
||||||
|
|
|
@ -8,7 +8,11 @@ module Kemal
|
||||||
INSTANCE = Config.new
|
INSTANCE = Config.new
|
||||||
HANDLERS = [] of HTTP::Handler
|
HANDLERS = [] of HTTP::Handler
|
||||||
ERROR_HANDLERS = {} of Int32 => HTTP::Server::Context -> String
|
ERROR_HANDLERS = {} of Int32 => HTTP::Server::Context -> String
|
||||||
|
{% if flag?(:without_openssl) %}
|
||||||
|
@ssl : Bool?
|
||||||
|
{% else %}
|
||||||
@ssl : OpenSSL::SSL::Context::Server?
|
@ssl : OpenSSL::SSL::Context::Server?
|
||||||
|
{% end %}
|
||||||
|
|
||||||
property host_binding, ssl, port, env, public_folder, logging,
|
property host_binding, ssl, port, env, public_folder, logging,
|
||||||
always_rescue, serve_static, server, extra_options
|
always_rescue, serve_static, server, extra_options
|
||||||
|
|
Loading…
Reference in a new issue