class Marten::Conf::GlobalSettings
- Marten::Conf::GlobalSettings
- Reference
- Object
Overview
Defines the global settings of a Marten web application.
Defined in:
marten/conf/global_settings.crmarten/conf/global_settings/assets.cr
marten/conf/global_settings/content_security_policy.cr
marten/conf/global_settings/csrf.cr
marten/conf/global_settings/database.cr
marten/conf/global_settings/emailing.cr
marten/conf/global_settings/i18n.cr
marten/conf/global_settings/media_files.cr
marten/conf/global_settings/method_override.cr
marten/conf/global_settings/sessions.cr
marten/conf/global_settings/ssl_redirect.cr
marten/conf/global_settings/strict_stransport_security.cr
marten/conf/global_settings/templates.cr
marten/conf/global_settings/trailing_slash.cr
Constructors
Instance Method Summary
-
#allowed_hosts : Array(String)
Returns the explicit list of allowed hosts for the application.
-
#allowed_hosts=(allowed_hosts : Array(String))
Allows to set the explicit list of allowed hosts for the application.
-
#assets
Provides access to assets settings.
-
#cache_store : Marten::Cache::Store::Base
Returns the global cache store.
-
#cache_store=(cache_store : Marten::Cache::Store::Base)
Allows to set the global cache store.
-
#content_security_policy
Provides access to the content security policy settings.
-
#content_security_policy(&)
Provides access to the content security policy settings.
-
#csrf
Provides access to request forgery protection settings.
-
#database(id = DB::Connection::DEFAULT_CONNECTION_NAME, &)
Allows to configure a specific database connection for the application.
-
#databases : Array(Marten::Conf::GlobalSettings::Database)
Returns the application database configurations.
-
#debug : Bool
Returns a boolean indicating whether the application runs in debug mode.
-
#debug=(debug : Bool)
Allows to activate or deactive debug mode.
-
#emailing
Provides access to emailing settings.
-
#handler400 : Marten::Handlers::Base.class
Returns the configured handler class that should generate responses for Bad Request responses (HTTP 400).
-
#handler400=(handler400 : ::Marten::Handlers::Base.class)
Allows to set the handler class that should generate responses for Bad Request responses (HTTP 400).
-
#handler403 : Marten::Handlers::Base.class
Returns the configured handler class that should generate responses for Permission Denied responses (HTTP 403).
-
#handler403=(handler403 : ::Marten::Handlers::Base.class)
Allows to set the handler class that should generate responses for Permission Denied responses (HTTP 403).
-
#handler404 : Marten::Handlers::Base.class
Returns the configured handler class that should generate responses for Not Found responses (HTTP 404).
-
#handler404=(handler404 : ::Marten::Handlers::Base.class)
Allows to set the handler class that should generate responses for Not Found responses (HTTP 404).
-
#handler500 : Marten::Handlers::Base.class
Returns the configured handler class that should generate responses for Internal Error responses (HTTP 500).
-
#handler500=(handler500 : ::Marten::Handlers::Base.class)
Allows to set the handler class that should generate responses for Internal Error responses (HTTP 500).
-
#host : String
Returns the host the HTTP server running the application will be listening on.
-
#host=(host : String)
Allows to set the host the HTTP server running the application will be listening on.
-
#i18n
Provides access to internationalization settings.
-
#installed_apps : Array(Marten::Apps::Config.class)
Returns the third-party applications used by the project.
-
#installed_apps=(v)
Allows to define the third-party applications used by the project.
-
#log_backend : Log::Backend
Returns the log backend used by the application.
-
#log_backend=(log_backend : ::Log::Backend)
Allows to set the log backend used by the application.
-
#log_level : Log::Severity
The default log level used by the application.
-
#log_level=(log_level : ::Log::Severity)
Allows to set the default log level that will be used by the application (defaults to info).
-
#media_files
Provides access to media files settings.
-
#method_override
Provides access to method overriding settings.
-
#middleware : Array(Marten::Middleware.class)
Returns the list of middlewares used by the application.
-
#middleware=(v)
Allows to define the list of middlewares used by the application.
-
#port : Int32
Returns the port the HTTP server running the application will be listening on.
-
#port=(port : Int32)
Allows to set the port the HTTP server running the application will be listening on.
-
#port_reuse : Bool
Returns a boolean indicating whether multiple processes can bind to the same HTTP server port.
-
#port_reuse=(port_reuse : Bool)
Allows to indicate whether multiple processes can bind to the same HTTP server port.
-
#request_max_parameters : Int32?
Returns the maximum number of allowed parameters per request (such as GET or POST parameters).
-
#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).
-
#root_path : String?
Returns the root path of the application.
-
#root_path=(path : Nil | Path | String | Symbol)
Allows to set the root path of the application.
-
#secret_key : String
Returns the secret key of the application.
-
#secret_key=(secret_key : String)
Allows to set the secret key of the application.
-
#sessions
Provides access to sessions settings.
-
#ssl_redirect
Provides access to SSL redirect settings.
-
#strict_transport_security
Provides access to strict transport security settings.
-
#templates
Provides access to templates settings.
-
#time_zone : Time::Location
Returns the default time zone used by the application when it comes to display date times.
-
#time_zone=(time_zone : Time::Location)
Allows to set the default time zone used by the application when it comes to display date times.
-
#trailing_slash : Marten::Conf::GlobalSettings::TrailingSlash
Returns the trailing slash strategy.
-
#trailing_slash=(trailing_slash : Marten::Conf::GlobalSettings::TrailingSlash)
Allows to configure the trailing slash strategy.
-
#use_x_forwarded_host : Bool
Returns a boolean indicating whether the X-Forwarded-Host header is used to look for the host.
-
#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.
-
#use_x_forwarded_port : Bool
Returns a boolean indicating if the X-Forwarded-Port header is used to determine the port of a request.
-
#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.
-
#use_x_forwarded_proto : Bool
Returns a boolean indicating if the X-Forwarded-Proto header is used to determine whether a request is secure.
-
#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.
-
#x_frame_options : String
Returns the value to use for the X-Frame-Options header when the associated middleware is used.
-
#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.
Constructor Detail
Instance Method Detail
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.
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.
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.
Allows to configure a specific database connection for the application.
Returns the application database configurations.
Returns the configured handler class that should generate responses for Bad Request responses (HTTP 400).
Allows to set the handler class that should generate responses for Bad Request responses (HTTP 400).
Returns the configured handler class that should generate responses for Permission Denied responses (HTTP 403).
Allows to set the handler class that should generate responses for Permission Denied responses (HTTP 403).
Returns the configured handler class that should generate responses for Not Found responses (HTTP 404).
Allows to set the handler class that should generate responses for Not Found responses (HTTP 404).
Returns the configured handler class that should generate responses for Internal Error responses (HTTP 500).
Allows to set the handler class that should generate responses for Internal Error responses (HTTP 500).
Allows to set the host the HTTP server running the application will be listening on.
Returns the third-party applications used by the project.
Allows to set the log backend used by the application.
Allows to set the default log level that will be used by the application (defaults to info).
Returns the list of middlewares used by the application.
Allows to set the port the HTTP server running the application will be listening on.
Returns a boolean indicating whether multiple processes can bind to the same HTTP server port.
Allows to indicate whether multiple processes can bind to the same HTTP server port.
Returns the maximum number of allowed parameters per request (such as GET or POST parameters).
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.
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.
Allows to set the secret key of the application.
The secret key will be used provide cryptographic signing. It should be unique and unpredictable.
Returns the default time zone used by the application when it comes to display date times.
Allows to set the default time zone used by the application when it comes to display date times.
Returns the trailing slash strategy.
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.
Returns a boolean indicating whether the X-Forwarded-Host header is used to look for the host.
Allows to set whether the X-Forwarded-Host header is used to look for the host.
Returns a boolean indicating if the X-Forwarded-Port header is used to determine the port of a request.
Allows to set whether the X-Forwarded-Port header is used to determine the port of a request.
Returns a boolean indicating if the X-Forwarded-Proto header is used to determine whether a request is secure.
Allows to set whether the X-Forwarded-Proto header should be used to determine whether a request is secure.
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.
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.