Read env from KEMAL_ENV instead of -e. Fixes #168

This commit is contained in:
Sdogruyol 2016-07-03 23:49:16 +03:00
parent 19581d6e3e
commit 2c0dc7fa63

View file

@ -8,6 +8,7 @@ module Kemal
@key_file = ""
@cert_file = ""
@config = Kemal.config
read_env
parse
configure_ssl
end
@ -20,9 +21,6 @@ module Kemal
opts.on("-p PORT", "--port PORT", "Port to listen for connections (defaults to 3000)") do |opt_port|
@config.port = opt_port.to_i
end
opts.on("-e ENV", "--environment ENV", "Environment [development, production] (defaults to development). Set `production` to boost performance") do |env|
@config.env = env
end
opts.on("-s", "--ssl", "Enables SSL") do
@ssl_enabled = true
end
@ -49,5 +47,9 @@ module Kemal
Kemal.config.ssl = ssl.context
end
end
def read_env
@config.env = ENV.fetch("KEMAL_ENV", "development")
end
end
end