| 1 | |||
| 2 | =pod | ||
| 3 | |||
| 4 | =encoding utf8 | ||
| 5 | |||
| 6 | Доброго всем | ||
| 7 | |||
| 8 | =head1 Mojolicious::Che | ||
| 9 | |||
| 10 | ¡ ¡ ¡ ALL GLORY TO GLORIA ! ! ! | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | Config.pm - Пример конфига для Mojolicious::Che приложения | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | See raw this module content. | ||
| 19 | |||
| 20 | =cut | ||
| 21 | |||
| 22 | |||
| 23 | { | ||
| 24 | 'Проект'=>'Тест-проект', | ||
| 25 | # mojo => { | ||
| 26 | # mode=>..., | ||
| 27 | # log_level => ..., | ||
| 28 | # secrets => ..., | ||
| 29 | # plugins=> ..., | ||
| 30 | # session => ..., | ||
| 31 | # hooks => ..., | ||
| 32 | # has => ..., | ||
| 33 | # }, | ||
| 34 | mojo_mode=> 'development', | ||
| 35 | mojo_log=>{level => 'debug'}, | ||
| 36 | # plugins | ||
| 37 | 'плугины'=>[ | ||
| 38 | #~ [charset => { charset => 'UTF-8' }, ], | ||
| 39 | #~ ['HeaderCondition'], | ||
| 40 | #~ ['ParamsArray'], | ||
| 41 | #~ [Minion => {Pg => 'postgresql://postgres@/test'}], | ||
| 42 | ], | ||
| 43 | #mojo_session | ||
| 44 | 'сессия'=> {cookie_name => 'ELK'}, | ||
| 45 | #mojo_secret | ||
| 46 | 'шифры' => ['true 123 my app',], | ||
| 47 | # hooks | ||
| 48 | 'хуки'=>{ | ||
| 49 | #~ before_dispatch => sub {1;}, | ||
| 50 | }, | ||
| 51 | # has | ||
| 52 | 'хазы' => { | ||
| 53 | foo => sub {my $app = shift; return 'bar!';}, | ||
| 54 | }, | ||
| 55 | # dbh | ||
| 56 | 'базы000'=>{# will be as has dbh! | ||
| 57 | 'main' => { | ||
| 58 | # DBI->connect(dsn, user, passwd, $attrs) | ||
| 59 | connect => ["DBI:Pg:dbname=test;", "guest", undef, { | ||
| 60 | ShowErrorStatement => 1, | ||
| 61 | AutoCommit => 1, | ||
| 62 | RaiseError => 1, | ||
| 63 | PrintError => 1, | ||
| 64 | pg_enable_utf8 => 1, | ||
| 65 | #mysql_enable_utf8 => 1, | ||
| 66 | #mysql_auto_reconnect=>1, | ||
| 67 | }], | ||
| 68 | # will do on connect | ||
| 69 | do => ['set datestyle to "ISO, DMY";',], | ||
| 70 | # prepared sth will get $app->sth->{<dbh name>}{<sth name>} | ||
| 71 | sth => { | ||
| 72 | foo => <<SQL, | ||
| 73 | select * | ||
| 74 | from foo | ||
| 75 | where | ||
| 76 | bar = ?; | ||
| 77 | SQL | ||
| 78 | }, | ||
| 79 | } | ||
| 80 | }, | ||
| 81 | # sth | ||
| 82 | # prepared sth will get $app->sth->{<dbh name>}{<sth name>} | ||
| 83 | 'запросы' => { | ||
| 84 | main => { | ||
| 85 | now => "select now();" | ||
| 86 | }, | ||
| 87 | }, | ||
| 88 | # ns | namespaces | ||
| 89 | 'спейсы'=>[], | ||
| 90 | # routes | ||
| 91 | 'маршруты' => [ | ||
| 92 | [get=>'/', to=> {cb=>sub{shift->render(format=>'txt', text=>'Здорова!');},}], | ||
| 93 | ], | ||
| 94 | #~ 'задачи'=> {#first enable plugin Minion | ||
| 95 | #~ jobs => { | ||
| 96 | #~ slow_log => sub { | ||
| 97 | #~ my ($job, $msg) = @_; | ||
| 98 | #~ sleep 5; | ||
| 99 | #~ $job->app->log->error(qq{slow_log "$msg"}); | ||
| 100 | #~ }, | ||
| 101 | #~ }, | ||
| 102 | }; |