|o||It sets the default charset of outgoing content. charset= item will be added to Content-Type response header.|
|o||It makes Unicode bodies in HTTP responses of text/* types to be encoded to this charset.|
|o||It also indicates to Dancer in which charset the static files and templates are encoded.|
|o||If youre using Dancer::Plugin::Database, UTF-8 support will automatically be enabled for your database - see AUTOMATIC UTF-8 SUPPORT in Dancer::Plugin::Database|
You can cancel any charset processing by specifying your own charset in Content-Type header or by ensuring that response body leaves your handler without Unicode flag set (by encoding it into some 8bit charset, for example).
Also, since automatically serialized JSON responses have application/json Content-Type, you should always encode them by hand.
Can also be set with environment variable DANCER_CHARSET
Dancers Dancer::MIME module uses application/data as a default mime type. This setting lets the user change it. For example, if you have a lot of files being served in the <B>publicB> folder that do not have an extension, and are text files, set the default_mime_type to text/plain.
This is the name of the environment that should be used. Standard Dancer applications have an environments folder with specific configuration files for different environments (usually development and production environments). They specify different kinds of error reporting, deployment details, etc. These files are read after the generic config.yml configuration file.
The running environment can be set with:
set environment => "production";
Note that this variable is also used as a default value if other values are not defined.
Can also be set with environment variable DANCER_ENVIRONMENT
This is the path where your application will live. Its where Dancer will look by default for your config files, templates and static content.
It is typically set by use Dancer to use the same directory as your script.
Can also be set with environment variable DANCER_APPDIR
This is the directory, where static files are stored. Any existing file in that directory will be served as a static file, before matching any route.
By default it points to $appdir/public.
This is the directory where your templates and layouts live. Its the view part of MVC (model, view, controller).
This defaults to $appdir/views.
Allows you to configure which template engine should be used. For instance, to use Template Toolkit, add the following to config.yml:
The name of the layout to use when rendering view. Dancer will look for a matching template in the directory $views/layouts.
Your can override the default layout using the third argument of the template keyword. Check Dancer manpage for details.
strict_config (boolean, default: false)
global_warnings (boolean, default: false)
Can also be enabled by setting the environment variable DANCER_WARNINGS to a true value.
If set to true (the default), prints a banner at server startup with information such as versions and the environment (or dancefloor).
Can also be disabled by setting the environment variable DANCER_NO_STARTUP_INFO to a true value.
Can also be enabled by setting environment variable DANCER_TRACES to a true value.
If set to true, Dancer will fail during startup if your environment file is missing or cant be read. This is especially useful in production when you have things like memcached settings that need to be set per-environment. Defaults to false.
Can also be disabled by setting the environment variable DANCER_NO_SERVER_TOKENS to a true value.
Folder where the file logger saves log files.
Name of the file to create when file logger is active. It defaults to the environment setting contents.
Select which logger to use. For example, to write to log files in log_path:
Or to direct log messages to the console from which you started your Dancer app in standalone mode,
Various other logger backends are available on CPAN, including Dancer::Logger::Syslog, Dancer::Logger::Log4perl, Dancer::Logger::PSGI (which can, with the aid of Plack middlewares, send log messages to a browsers console window) and others.
Can also be set with environment variable DANCER_LOGGER
During development, youll probably want to use debug to see your own debug messages, and core if you need to see what Dancer is doing. In production, youll likely want error or warning only, for less-chatty logs.
<B>coreB> : all messages are logged, including some from Dancer itself <B>debugB> : all messages are logged <B>infoB> : only info, warning and error messages are logged <B>warningB> : only warning and error messages are logged <B>errorB> : only error messages are logged
If set to true, Dancer will render a detailed debug screen whenever an error is caught. If set to false, Dancer will render the default error page, using $public/$error_code.html if it exists or the template specified by the error_template setting.
The error screen attempts to sanitise sensitive looking information (passwords / card numbers in the request, etc) but you still should not have show_errors enabled whilst in production, as there is still a risk of divulging details.
error_template (template path)
This setting lets you specify a template to be used in case of runtime error. At the present moment the template can use three variables:
<B>titleB> The error title. <B>messageB> The error message. <B>codeB> The code throwing that error.
This setting lets you enable a session engine for your web application. By default sessions are disabled in Dancer. You must choose a session engine to use them.
See Dancer::Session for supported engines and their respective configuration.
The session expiry time in seconds, or as e.g. 2 hours (see expires in Dancer::Cookie. By default there is no specific expiry time.
The name of the cookie to store the session ID in. Defaults to dancer.session. This can be overridden by certain session engines.
The users session ID is stored in a cookie. If the session_secure setting is set to a true value, the cookie will be marked as secure, meaning it should only be sent over HTTPS connections.
Allows you to set the domain property on the cookie, which will override the default. This is useful for setting the session cookies domain to something like .domain.com so that the same cookie will be applicable and usable across subdomains of a base domain.
For simple pages where youre not doing anything dynamic, but still want to use the template engine to provide headers etc, you can use the auto_page feature to avoid the need to create a route for each page.
Simply enable auto_page in your config:
Dancer will honor your before_template_render code, and all default variables. They will be accessible and interpolated on automaticly-served pages.
The pages served this way will have Content-Type set to text/html, so dont use the feature for anything else.
Its possible to set the configuration directory and environment directory using these two environment variables. Setting DANCER_CONFDIR will have the same effect as doing
set confdir => /path/to/confdir
and setting DANCER_ENVDIR will be similar to:
set envdir => /path/to/environments
Some settings can be provided via environment variables at runtime, as detailed above; a full list of environment variables you can use follows.
This module has been written by Alexis Sukrieh <email@example.com> and others, see the AUTHORS file that comes with this distribution for details.
This module is free software and is released under the same terms as Perl itself.
Dancer Core Developers
This software is copyright (c) 2010 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|perl v5.20.3||DANCER::CONFIG (3)||2015-06-12|