#!/usr/bin/perl
use strict;
use warnings;
use utf8;
my $home = app->home;
my $mode = app->mode;
my $moniker = app->moniker;
#This is the default Ado (Mojolicious) application configuration file.
#Application instance is also available here via "app" Mojolicious specific keyword.
#Documentation can be accessed at http://localhost:3000/perldoc/
#The operating mode for your application, defaults to a value
#from the MOJO_MODE and PLACK_ENV environment variables or 'development'.
#See /perldoc/Mojolicious/#mode
#Uncomment the line below to change it to 'production'.
#app->mode('production');
#Fallback to some default secret for this deployment
#See /perldoc/Mojolicious#secrets
#app->secrets([Mojo::Util::sha1_sum($mode . $home),]);
#Application/site specific templates
#See /perldoc/Mojolicious/Renderer#paths
#unshift @{app->renderer->paths}, $home->rel_dir('site_templates');
#Application specific static files
#See /perldoc/Mojolicious/Static
#It is better to leave static files to be served by a server like Apache
#This setting can be used during development.
#unshift @{$app->static->paths}, app->home->rel_dir('path/to/other/public/files');
#Setting the Controller class from which all controllers must inherit.
#See /perldoc/Mojolicious/#controller_class
#See /perldoc/Mojolicious/Guides/Growing#Controller_class
#app->controller_class('Ado::Control');
#Namespace(s) to load controllers from
#See /perldoc/Mojolicious#routes
#app->routes->namespaces(['Ado::Control']);
#Namespaces to load plugins from
#See /perldoc/Mojolicious#plugins
#See /perldoc/Mojolicious/Plugins#PLUGINS
#app->plugins->namespaces(['Mojolicious::Plugin', 'Ado::Plugin',]);
#Ado namespace to load commands from
#See /perldoc/Mojolicious/#commands
#See /perldoc/Ado/Command
#unshift @{app->commands->namespaces}, 'Ado::Command';
# Add custom MIME type
#See /perldoc/Mojolicious/#types
#app->types->type(twt => 'text/tweet');
#Stash defaults. See /perldoc/Mojolicious/#defaults
$app->defaults(layout => 'default');
{
# Hypnotoad Settings (optimized for blocking operations)
# See /perldoc/Mojo/Server/Hypnotoad#SETTINGS
# and /perldoc/Mojolicious/Guides/Cookbook#Hypnotoad
hypnotoad => {
#listen => ['http://*:9090'],
#proxy => 1,
workers => 20,
clients => 1,
},
session => {
#Type of the session this application will use
#Possible values are:
# 'file'(Ado::Sessions::File),
# 'database'(Ado::Sessions::Database),
# 'mojo'(Mojolicious::Sessions)
type => 'database',
#Every sessions implementations has its own options
options => {
cookie_name => $moniker,
default_expiration => 86400,
}
},
#Plugins can be Mojolicious and Ado plugins.
# Every Ado::Plugin:: ISA Mojolicious::Plugin
#Plugin order is important. Any plugin depending on another
# must come after the plugin it depends on.
#A plugin may be loaded twice if it will do different
# things depending on configuration variables.
# See localhost:3000//perldoc/Mojolicious/Plugin/DSC
#If loaded twice Mojolicious::Plugin::DSC can connect to different databases
# and provide different dbix_helper for each connection.
#See /perldoc/Ado#load_plugins
plugins => [
'PODRenderer',
{name => 'charset', config => {charset => 'UTF-8'}},
{ name => 'DSC',
config => {
database => (
-e $home->rel_file("etc/$moniker.$mode.sqlite")
? $home->rel_file("etc/$moniker.$mode.sqlite")
: $home->rel_file("etc/$moniker.sqlite")
),
dbh_attributes => {sqlite_unicode => 1},
driver => 'SQLite',
namespace => 'Ado::Model',
onconnect_do => [
#Database engine specific code here.
#See /perldoc/Mojolicious/Plugin/DSC#onconnect_do
#Replace it with something else if using MySQL or PostgreSQL
#http://www.sqlite.org/pragma.html
'PRAGMA encoding = "UTF-8"',
'PRAGMA foreign_keys = ON',
'PRAGMA temp_store = MEMORY',
'PRAGMA synchronous = OFF',
'PRAGMA journal_mode=WAL',
#http://www.sqlite.org/lang_vacuum.html
#'VACUUM',
#Execute any arbitrary Perl code
#https://metacpan.org/pod/DBD::SQLite#dbh-sqlite_create_function-name-argc-code_ref
sub {
my $dbh = shift->dbh;
$dbh->sqlite_create_function('upper', 1, sub { uc(shift) });
$dbh->sqlite_create_function('lower', 1, sub { lc(shift) });
},
],
DEBUG => 0,
},
},
'SemanticUI',
#These are Ado plugins, loading their own config files.
'ado_helpers',
'markdown_renderer',
'auth',
'i18n',
#'admin',
#'vest',
#'blog',
#put your own routes for your private code in
# etc/plugins/routes.$mode.conf
'routes',
],
#Configuration for commands
#Every Ado::Command:: ISA Mojolicious::Command
commands => {},
#Routes order is important, so this configuration value is an ARRAYREF
#Routes added by plugins will be checked for match before these routes here.
routes => [
{ route => '/',
via => [qw(GET OPTIONS)],
#Ado::Control::Default::index()
to => 'default#index',
},
], #end routes
#MIME types
types => {
xhtml => 'application/xhtml+xml',
xht => 'application/xhtml+xml',
},
};