class

Marten::Conf::GlobalSettings

Inherits Reference / Object

Defines the global settings of a Marten web application.

Constructors

Instance methods

allowed_hosts

Returns the explicit list of allowed hosts for the application.

Source
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.

Source
assets

Provides access to assets settings.

Source
cache_store

Returns the global cache store.

Source
cache_store=(cache_store : Marten::Cache::Store::Base)

Allows to set the global cache store.

Source
content_security_policy

Provides access to the content security policy settings.

These setting values will be used by the Marten::Middleware::ContentSecurityPolicy middleware when inserting the Content-Security-Policy header in HTTP responses.

Source
content_security_policy

Provides access to the content security policy settings.

These setting values will be used by the Marten::Middleware::ContentSecurityPolicy middleware when inserting the Content-Security-Policy header in HTTP responses.

Source
csrf

Provides access to request forgery protection settings.

Source
database(id = DB::Connection::DEFAULT_CONNECTION_NAME, url : String | Nil = nil)

Allows to configure a specific database connection for the application using a connection URL.

Source
database(id = DB::Connection::DEFAULT_CONNECTION_NAME, url : String | Nil = nil, &)

Allows to configure a specific database connection for the application using a connection URL or a block.

Source
databases

Returns the application database configurations.

Source
date_input_formats

Returns the list of default date input formats.

The list of default date input formats is used by the Marten::Schema::Field::Date schema field to parse date values from strings. Note that the date input formats coming from locales will be used with priority over this default list.

Source
date_input_formats=(date_input_formats : Array(String))

Allows to set the list of default date input formats.

Source
date_time_input_formats

Returns the list of default date time input formats.

The list of default date time input formats is used by the Marten::Schema::Field::DateTime schema field to parse date time values from strings. Note that the date time input formats coming from locales will be used with priority over this default list.

Source
date_time_input_formats=(date_time_input_formats : Array(String))

Allows to set the list of default date time input formats.

Source
debug

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

Source
debug=(debug : Bool)

Allows to activate or deactive debug mode.

Source
debug?

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

Source
emailing

Provides access to emailing settings.

Source
handler400

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

Source
handler400=(handler400 : ::Marten::Handlers::Base.class)

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

Source
handler403

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

Source
handler403=(handler403 : ::Marten::Handlers::Base.class)

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

Source
handler404

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

Source
handler404=(handler404 : ::Marten::Handlers::Base.class)

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

Source
handler500

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

Source
handler500=(handler500 : ::Marten::Handlers::Base.class)

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

Source
host

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

Source
host=(host : String)

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

Source
i18n

Provides access to internationalization settings.

Source
installed_apps

Returns the third-party applications used by the project.

Source
installed_apps=(v)

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

Source
log_backend

Returns the log backend used by the application.

Source
log_backend=(log_backend : ::Log::Backend)

Allows to set the log backend used by the application.

Source
log_level

The default log level used by the application.

Source
log_level=(log_level : ::Log::Severity)

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

Source
media_files

Provides access to media files settings.

Source
method_override

Provides access to method overriding settings.

Source
middleware

Returns the list of middlewares used by the application.

Source
middleware=(v)

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

Source
port

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

Source
port=(port : Int32)

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

Source
port_reuse

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

Source
port_reuse=(port_reuse : Bool)

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

Source
port_reuse?

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

Source
referrer_policy

Returns the default value to use for the Referrer-Policy header.

The value of this setting will be used by the Marten::Middleware::ReferrerPolicy middleware when inserting the Referrer-Policy header in HTTP responses.

Source
referrer_policy=(referrer_policy : String)

Allows to set the default value to use for the Referrer-Policy header.

This value will be used by the Marten::Middleware::ReferrerPolicy middleware when inserting the Referrer-Policy header in HTTP responses.

Source
request_max_parameters

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

Source
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.

Source
root_path

Returns the root path of the application.

Source
root_path=(path : Nil | Path | String | Symbol)

Allows to set the root path of the application.

The root path of the application specifies the actual location of the project sources in your system. This can prove helpful in scenarios where the project was compiled in a specific location different from the final destination where the project sources are copied. For instance, platforms like Heroku often fall under this category. By configuring the root path, you can ensure that your application correctly locates the required project sources and avoids any discrepancies arising from inconsistent source paths. This can prevent issues related to missing dependencies or missing app-related files (eg. locales or templates) and make your application more robust and reliable.

Source
secret_key

Returns the secret key of the application.

Source
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.

Source
sessions

Provides access to sessions settings.

Source
ssl_redirect

Provides access to SSL redirect settings.

Source
strict_transport_security

Provides access to strict transport security settings.

Source
templates

Provides access to templates settings.

Source
time_zone

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

Source
time_zone=(time_zone : Time::Location)

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

Source
trailing_slash

Returns the trailing slash strategy.

Source
trailing_slash=(trailing_slash : Marten::Conf::GlobalSettings::TrailingSlash)

Allows to configure the trailing slash strategy.

The trailing slash strategy is used to determine how the application should handle trailing slashes in URLs. The default strategy is :do_nothing, which means that the application will not enforce any trailing slash policy. The other available strategies are :add and :remove, which will respectively add or remove trailing slashes from URLs if they can't be found.

Source
unsupported_http_method_strategy

Returns the strategy to use when an unsupported HTTP method is encountered.

Source
unsupported_http_method_strategy=(unsupported_http_method_strategy : Marten::Conf::GlobalSettings::UnsupportedHttpMethodStrategy)

Allows to set the strategy to use when an unsupported HTTP method is encountered.

The default strategy is :deny, which means that the application will return a 405 Method Not Allowed response when an unsupported HTTP method is encountered. The other available strategy is :hide, which will results in 404 Not Found responses being returned instead.

Source
use_x_forwarded_host

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

Source
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.

Source
use_x_forwarded_host?

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

Source
use_x_forwarded_port

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

Source
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.

Source
use_x_forwarded_port?

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

Source
use_x_forwarded_proto

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

Source
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.

Source
use_x_forwarded_proto?

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

Source
x_frame_options

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.

Source
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.

Source

Nested types