class Marten::Conf::GlobalSettings

Overview

Defines the global settings of a Marten web application.

Defined in:

marten/conf/global_settings.cr
marten/conf/global_settings/assets.cr
marten/conf/global_settings/csrf.cr
marten/conf/global_settings/database.cr
marten/conf/global_settings/i18n.cr
marten/conf/global_settings/media_files.cr
marten/conf/global_settings/sessions.cr
marten/conf/global_settings/strict_stransport_security.cr
marten/conf/global_settings/templates.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def allowed_hosts : Array(String) #

Returns the explicit list of allowed hosts for the application.


[View source]
def allowed_hosts=(allowed_hosts : Array(String)) #

Allows to set the explicit list of allowed hosts for the application.

The application has to be explictely configured to serve a list of allowed hosts. This is to mitigate HTTP Host header attacks.


[View source]
def assets #

Provides access to assets settings.


[View source]
def csrf #

Provides access to request forgery protection settings.


[View source]
def database(id = DB::Connection::DEFAULT_CONNECTION_NAME, &) #

Allows to configure a specific database connection for the application.


[View source]
def databases : Array(Marten::Conf::GlobalSettings::Database) #

Returns the application database configurations.


[View source]
def debug : Bool #

Returns a boolean indicating whether the application runs in debug mode.


[View source]
def debug=(debug : Bool) #

Allows to activate or deactive debug mode.


[View source]
def handler400 : Marten::Handlers::Base.class #

Returns the configured handler class that should generate responses for Bad Request responses (HTTP 400).


[View source]
def handler400=(handler400 : ::Marten::Handlers::Base.class) #

Allows to set the handler class that should generate responses for Bad Request responses (HTTP 400).


[View source]
def handler403 : Marten::Handlers::Base.class #

Returns the configured handler class that should generate responses for Permission Denied responses (HTTP 403).


[View source]
def handler403=(handler403 : ::Marten::Handlers::Base.class) #

Allows to set the handler class that should generate responses for Permission Denied responses (HTTP 403).


[View source]
def handler404 : Marten::Handlers::Base.class #

Returns the configured handler class that should generate responses for Not Found responses (HTTP 404).


[View source]
def handler404=(handler404 : ::Marten::Handlers::Base.class) #

Allows to set the handler class that should generate responses for Not Found responses (HTTP 404).


[View source]
def handler500 : Marten::Handlers::Base.class #

Returns the configured handler class that should generate responses for Internal Error responses (HTTP 500).


[View source]
def handler500=(handler500 : ::Marten::Handlers::Base.class) #

Allows to set the handler class that should generate responses for Internal Error responses (HTTP 500).


[View source]
def host : String #

Returns the host the HTTP server running the application will be listening on.


[View source]
def host=(host : String) #

Allows to set the host the HTTP server running the application will be listening on.


[View source]
def i18n #

Provides access to internationalization settings.


[View source]
def installed_apps : Array(Marten::Apps::Config.class) #

Returns the third-party applications used by the project.


[View source]
def installed_apps=(v) #

Allows to define the third-party applications used by the project.


[View source]
def log_backend : Log::Backend #

Returns the log backend used by the application.


[View source]
def log_backend=(log_backend : ::Log::Backend) #

Allows to set the log backend used by the application.


[View source]
def log_level : Log::Severity #

The default log level used by the application.


[View source]
def log_level=(log_level : ::Log::Severity) #

Allows to set the default log level that will be used by the application (defaults to info).


[View source]
def media_files #

Provides access to media files settings.


[View source]
def middleware : Array(Marten::Middleware.class) #

Returns the list of middlewares used by the application.


[View source]
def middleware=(v) #

Allows to define the list of middlewares used by the application.


[View source]
def port : Int32 #

Returns the port the HTTP server running the application will be listening on.


[View source]
def port=(port : Int32) #

Allows to set the port the HTTP server running the application will be listening on.


[View source]
def port_reuse : Bool #

Returns a boolean indicating whether multiple processes can bind to the same HTTP server port.


[View source]
def port_reuse=(port_reuse : Bool) #

Allows to indicate whether multiple processes can bind to the same HTTP server port.


[View source]
def request_max_parameters : Int32? #

Returns the maximum number of allowed parameters per request (such as GET or POST parameters).


[View source]
def request_max_parameters=(request_max_parameters : Int32 | Nil) #

Allows to set the maximum number of allowed parameters per request (such as GET or POST parameters).

This maximum limit is used to prevent large requests that could be used in the context of DOS attacks. Setting this value to nil will disable this behaviour.


[View source]
def secret_key : String #

Returns the secret key of the application.


[View source]
def secret_key=(secret_key : String) #

Allows to set the secret key of the application.

The secret key will be used provide cryptographic signing. It should be unique and unpredictable.


[View source]
def sessions #

Provides access to sessions settings.


[View source]
def strict_transport_security #

Provides access to strict transport security settings.


[View source]
def templates #

Provides access to templates settings.


[View source]
def time_zone : Time::Location #

Returns the default time zone used by the application when it comes to display date times.


[View source]
def time_zone=(time_zone : Time::Location) #

Allows to set the default time zone used by the application when it comes to display date times.


[View source]
def use_x_forwarded_host : Bool #

Returns a boolean indicating whether the X-Forwarded-Host header is used to look for the host.


[View source]
def use_x_forwarded_host=(use_x_forwarded_host : Bool) #

Allows to set whether the X-Forwarded-Host header is used to look for the host.


[View source]
def use_x_forwarded_port : Bool #

Returns a boolean indicating if the X-Forwarded-Port header is used to determine the port of a request.


[View source]
def use_x_forwarded_port=(use_x_forwarded_port : Bool) #

Allows to set whether the X-Forwarded-Port header is used to determine the port of a request.


[View source]
def use_x_forwarded_proto : Bool #

Returns a boolean indicating if the X-Forwarded-Proto header is used to determine whether a request is secure.


[View source]
def use_x_forwarded_proto=(use_x_forwarded_proto : Bool) #

Allows to set whether the X-Forwarded-Proto header should be used to determine whether a request is secure.


[View source]
def x_frame_options : String #

Returns the value to use for the X-Frame-Options header when the associated middleware is used.

The value of this setting will be used by the Marten::Middleware::XFrameOptions middleware when inserting the X-Frame-Options header in HTTP responses.


[View source]
def x_frame_options=(x_frame_options : String | Symbol) #

Allows to set the value to use for the X-Frame-Options header when the associated middleware is used.

This value will be used by the Marten::Middleware::XFrameOptions middleware when inserting the X-Frame-Options header in HTTP responses.


[View source]