Make ssl api more idiomatic

This commit is contained in:
Sdogruyol 2016-12-04 14:12:51 +03:00
parent f3f9864ae5
commit 878c70e0d9
2 changed files with 4 additions and 4 deletions

View file

@ -50,8 +50,8 @@ module Kemal
exit exit
end end
ssl = Kemal::SSL.new ssl = Kemal::SSL.new
ssl.set_key_file @key_file.not_nil! ssl.key_file = @key_file.not_nil!
ssl.set_cert_file @cert_file.not_nil! ssl.cert_file = @cert_file.not_nil!
Kemal.config.ssl = ssl.context Kemal.config.ssl = ssl.context
end end
{% end %} {% end %}

View file

@ -6,11 +6,11 @@ module Kemal
@context = OpenSSL::SSL::Context::Server.new @context = OpenSSL::SSL::Context::Server.new
end end
def set_key_file(key_file) def key_file=(key_file)
@context.private_key = key_file @context.private_key = key_file
end end
def set_cert_file(cert_file) def cert_file=(cert_file)
@context.certificate_chain = cert_file @context.certificate_chain = cert_file
end end
end end