kemal/src/kemal/config.cr

37 lines
549 B
Crystal
Raw Normal View History

2015-10-23 18:33:26 +00:00
module Kemal
2014-07-30 22:17:53 +00:00
class Config
INSTANCE = Config.new
2015-11-12 20:48:22 +00:00
HANDLERS = [] of HTTP::Handler
2014-07-30 22:17:53 +00:00
property ssl
property port
2015-11-16 21:55:02 +00:00
property env
2015-12-08 20:15:13 +00:00
property workers
2014-07-30 22:17:53 +00:00
def initialize
@port = 3000
2015-11-18 20:45:49 +00:00
@env = "development" unless @env
2015-12-08 20:15:13 +00:00
@workers = 1
2014-07-30 22:17:53 +00:00
end
def scheme
ssl ? "https" : "http"
end
2015-11-12 20:48:22 +00:00
def handlers
HANDLERS
end
def add_handler(handler : HTTP::Handler)
HANDLERS << handler
end
2014-07-30 22:17:53 +00:00
end
def self.config
yield Config::INSTANCE
end
def self.config
Config::INSTANCE
end
end