From 39cfe14811343c60125b78f6cc090a9f624f67a7 Mon Sep 17 00:00:00 2001 From: Aurelien Louis Dit Picard Date: Wed, 21 Sep 2016 00:27:35 +0100 Subject: [PATCH] Adding port to Kemal#run (#208) Adding port to Kemal#run --- src/kemal.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kemal.cr b/src/kemal.cr index 65954ca..7029a80 100644 --- a/src/kemal.cr +++ b/src/kemal.cr @@ -5,11 +5,14 @@ require "./kemal/middleware/*" module Kemal # The command to run a `Kemal` application. - def self.run + # The port can be given to `#run` but is optionnal. + # If not given Kemal will use the default config port (`Kemal::Config#port`) + def self.run(port = nil) Kemal::CLI.new config = Kemal.config config.setup config.add_handler Kemal::RouteHandler::INSTANCE + config.port = port if port config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers) {% if ! flag?(:without_openssl) %}