mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Disable signal trap for usage kemal with outher tools
This commit is contained in:
parent
05d55540b9
commit
88807b90c6
3 changed files with 13 additions and 1 deletions
|
@ -40,6 +40,14 @@ describe "Config" do
|
|||
config.shutdown_message.should eq true
|
||||
end
|
||||
|
||||
it "toggles the disable trap signal" do
|
||||
config = Kemal.config
|
||||
config.disable_trap_signal = false
|
||||
config.disable_trap_signal.should eq false
|
||||
config.disable_trap_signal = true
|
||||
config.disable_trap_signal.should eq true
|
||||
end
|
||||
|
||||
it "adds custom options" do
|
||||
config = Kemal.config
|
||||
ARGV.push("--test")
|
||||
|
|
|
@ -89,6 +89,8 @@ module Kemal
|
|||
end
|
||||
|
||||
private def self.setup_trap_signal
|
||||
return if Kemal.config.disable_trap_signal
|
||||
|
||||
Signal::INT.trap do
|
||||
log "#{Kemal.config.app_name} is going to take a rest!" if Kemal.config.shutdown_message
|
||||
Kemal.stop
|
||||
|
|
|
@ -21,7 +21,7 @@ module Kemal
|
|||
{% end %}
|
||||
|
||||
property host_binding, ssl, port, env, public_folder, logging, running
|
||||
property always_rescue, server : HTTP::Server?, extra_options, shutdown_message
|
||||
property always_rescue, server : HTTP::Server?, extra_options, shutdown_message, disable_trap_signal
|
||||
property serve_static : (Bool | Hash(String, Bool))
|
||||
property static_headers : (HTTP::Server::Response, String, File::Info -> Void)?
|
||||
property powered_by_header : Bool = true, app_name
|
||||
|
@ -41,6 +41,7 @@ module Kemal
|
|||
@default_handlers_setup = false
|
||||
@running = false
|
||||
@shutdown_message = true
|
||||
@disable_trap_signal = false
|
||||
@handler_position = 0
|
||||
end
|
||||
|
||||
|
@ -61,6 +62,7 @@ module Kemal
|
|||
@router_included = false
|
||||
@handler_position = 0
|
||||
@default_handlers_setup = false
|
||||
@disable_trap_signal = false
|
||||
HANDLERS.clear
|
||||
CUSTOM_HANDLERS.clear
|
||||
FILTER_HANDLERS.clear
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue