Allow for disabling the shutdown message (#292)
Allow for disabling the shutdown message
This commit is contained in:
parent
209a9e576c
commit
c08bf71d88
3 changed files with 12 additions and 2 deletions
|
@ -29,6 +29,14 @@ describe "Config" do
|
||||||
config.handlers.size.should eq(6)
|
config.handlers.size.should eq(6)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "toggles the shutdown message" do
|
||||||
|
config = Kemal.config
|
||||||
|
config.shutdown_message = false
|
||||||
|
config.shutdown_message.should eq false
|
||||||
|
config.shutdown_message = true
|
||||||
|
config.shutdown_message.should eq true
|
||||||
|
end
|
||||||
|
|
||||||
it "adds custom options" do
|
it "adds custom options" do
|
||||||
config = Kemal.config
|
config = Kemal.config
|
||||||
ARGV.push("--test")
|
ARGV.push("--test")
|
||||||
|
|
|
@ -41,7 +41,7 @@ module Kemal
|
||||||
# Test environment doesn't need to have signal trap, built-in images, and logging.
|
# Test environment doesn't need to have signal trap, built-in images, and logging.
|
||||||
unless config.env == "test"
|
unless config.env == "test"
|
||||||
Signal::INT.trap {
|
Signal::INT.trap {
|
||||||
log "Kemal is going to take a rest!\n"
|
log "Kemal is going to take a rest!\n" if config.shutdown_message
|
||||||
Kemal.stop
|
Kemal.stop
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ module Kemal
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
property host_binding, ssl, port, env, public_folder, logging, running,
|
property host_binding, ssl, port, env, public_folder, logging, running,
|
||||||
always_rescue, serve_static : (Bool | Hash(String, Bool)), server, extra_options
|
always_rescue, serve_static : (Bool | Hash(String, Bool)), server, extra_options,
|
||||||
|
shutdown_message
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@host_binding = "0.0.0.0"
|
@host_binding = "0.0.0.0"
|
||||||
|
@ -32,6 +33,7 @@ module Kemal
|
||||||
@custom_handler_position = 4
|
@custom_handler_position = 4
|
||||||
@default_handlers_setup = false
|
@default_handlers_setup = false
|
||||||
@running = false
|
@running = false
|
||||||
|
@shutdown_message = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
|
|
Loading…
Reference in a new issue