class

Kemal::Config

Inherits Reference < Object

Stores all the configuration options for a Kemal application. It's a singleton and you can access it like.

Kemal.config

Constants

CUSTOM_HANDLERS = [] of Tuple(Int32 | ::Nil, HTTP::Handler)
ERROR_HANDLERS = {} of Int32 => (HTTP::Server::Context, Exception -> String)
EXCEPTION_HANDLERS = {} of Exception.class => (HTTP::Server::Context, Exception -> String)
FILTER_HANDLERS = [] of HTTP::Handler
HANDLERS = [] of HTTP::Handler
INSTANCE = Config.new

Constructors

Instance methods

add_error_handler(status_code : Int32, &handler : HTTP::Server::Context, Exception -> _)

Adds an error handler for the given HTTP status code

Source
add_exception_handler(exception : Exception.class, &handler : HTTP::Server::Context, Exception -> _)

Adds an error handler for the given exception

Source
add_filter_handler(handler : HTTP::Handler)
Source
add_handler(handler : HTTP::Handler, position : Int32)
Source
add_handler(handler : HTTP::Handler)
Source
always_rescue
Source
always_rescue=(always_rescue : Bool)
Source
app_name
Source
app_name=(app_name : String)
Source
clear
Source
env=(env : String)
Source
error_handlers

Returns the defined error handlers for HTTP status codes

Source
exception_handlers

Returns the defined error handlers for exceptions

Source
extra_options
Source
extra_options
Source
extra_options=(extra_options : Nil | OptionParser -> _)
Source
handlers
Source
handlers=(handlers : Array(HTTP::Handler))
Source
host_binding
Source
host_binding=(host_binding : String)
Source
logger

DEPRECATED Use standard library Log

Source
logger=(logger : Kemal::BaseLogHandler)

DEPRECATED Use standard library Log

Source
logging
Source
logging=(logging : Bool)
Source
max_multipart_form_field_size
Source
max_multipart_form_field_size=(max_multipart_form_field_size : Int32)
Source
max_request_body_size
Source
max_request_body_size=(max_request_body_size : Int32)
Source
max_route_cache_size
Source
max_route_cache_size=(max_route_cache_size : Int32)
Source
port
Source
port=(port : Int32)
Source
powered_by_header=(powered_by_header : Bool)
Source
powered_by_header?
Source
public_folder
Source
public_folder=(public_folder : String)
Source
running
Source
running=(running : Bool)
Source
scheme
Source
serve_static
Source
serve_static=(serve_static : Bool | Hash(String, Bool))
Source
server
Source
server=(server : HTTP::Server | Nil)
Source
setup
Source
shutdown_message
Source
shutdown_message=(shutdown_message : Bool)
Source
shutdown_timeout
Source
shutdown_timeout=(shutdown_timeout : Time::Span)
Source
static_headers
Source
static_headers=(static_headers : HTTP::Server::Context, String, File::Info -> | Nil)
Source
websocket_allowed_origins

When non-empty, WebSocket upgrade requests must send an Origin header that matches one of these values (after normalization: scheme/host/port only). Entries use the serialized origin form, e.g. "https://example.com" or "http://localhost:3000". Use "null" to allow the browser's opaque "null" origin.

Source
websocket_allowed_origins=(websocket_allowed_origins : Array(String))

When non-empty, WebSocket upgrade requests must send an Origin header that matches one of these values (after normalization: scheme/host/port only). Entries use the serialized origin form, e.g. "https://example.com" or "http://localhost:3000". Use "null" to allow the browser's opaque "null" origin.

Source