Check for KEMAL_ENV variable already in Config#initialize (#552)

This commit is contained in:
Sijawusz Pur Rahnama 2019-08-30 13:20:38 +02:00 committed by Serdar Dogruyol
parent 15022c25b8
commit 740cb188a9
2 changed files with 10 additions and 17 deletions

View file

@ -8,7 +8,6 @@ module Kemal
@key_file = "" @key_file = ""
@cert_file = "" @cert_file = ""
@config = Kemal.config @config = Kemal.config
read_env
if args if args
parse args parse args
end end
@ -52,11 +51,5 @@ module Kemal
end end
{% end %} {% end %}
end end
private def read_env
if kemal_env = ENV["KEMAL_ENV"]?
@config.env = kemal_env
end
end
end end
end end

View file

@ -29,7 +29,7 @@ module Kemal
def initialize def initialize
@host_binding = "0.0.0.0" @host_binding = "0.0.0.0"
@port = 3000 @port = 3000
@env = "development" @env = ENV["KEMAL_ENV"]? || "development"
@serve_static = {"dir_listing" => false, "gzip" => true} @serve_static = {"dir_listing" => false, "gzip" => true}
@public_folder = "./public" @public_folder = "./public"
@logging = true @logging = true