mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
0.11.0
This commit is contained in:
parent
664673f125
commit
fd904cd98d
2 changed files with 33 additions and 25 deletions
|
@ -1,7 +1,8 @@
|
||||||
require "./kemal/*"
|
require "./kemal/*"
|
||||||
require "./kemal/middleware/*"
|
require "./kemal/middleware/*"
|
||||||
|
|
||||||
at_exit do
|
module Kemal
|
||||||
|
def self.run
|
||||||
Kemal::CLI.new
|
Kemal::CLI.new
|
||||||
config = Kemal.config
|
config = Kemal.config
|
||||||
config.setup
|
config.setup
|
||||||
|
@ -31,4 +32,9 @@ at_exit do
|
||||||
|
|
||||||
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
|
config.logger.write "[#{config.env}] Kemal is ready to lead at #{config.scheme}://#{config.host_binding}:#{config.port}\n"
|
||||||
server.listen
|
server.listen
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
at_exit do
|
||||||
|
Kemal.run if Kemal.config.run
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,8 @@ module Kemal
|
||||||
class Config
|
class Config
|
||||||
INSTANCE = Config.new
|
INSTANCE = Config.new
|
||||||
HANDLERS = [] of HTTP::Handler
|
HANDLERS = [] of HTTP::Handler
|
||||||
property host_binding, ssl, port, env, public_folder, logging, always_rescue, error_handler, serve_static
|
property host_binding, ssl, port, env, public_folder, logging,
|
||||||
|
always_rescue, error_handler, serve_static, run
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@host_binding = "0.0.0.0"
|
@host_binding = "0.0.0.0"
|
||||||
|
@ -14,6 +15,7 @@ module Kemal
|
||||||
@logger = nil
|
@logger = nil
|
||||||
@always_rescue = true
|
@always_rescue = true
|
||||||
@error_handler = nil
|
@error_handler = nil
|
||||||
|
@run = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def logger
|
def logger
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue