Skip to content

dim0xff/p5-Mojolicious-Plugin-PrettyConfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Mojolicious::Plugin::PrettyConfig - Easy setup your app via config

SYNOPSIS

# Mojolicious
$self->plugin(
    PrettyConfig => {
        pretty_cfg_code   => 1,
        pretty_cfg_scalar => 1,
    }
);

# Mojolicious::Lite
plugin PrettyConfig => {
    pretty_cfg_code   => 1,
    pretty_cfg_scalar => 1,
};

# In your config
app => [
    secrets  => \[ 'mySecret', 'myOldSecret' ],
    sessions => {
        default_expiration => 1800,
        cookie_name        => 'appSession',
    },
    routes => {
        get => [
            \" '/foo' => { controller => 'controller', action => 'do_foo' } => 'foo_action' ",
            sub {
                '/boo'
                    => { controller => 'controller', action => 'do_boo' }
                    => 'boo_action'
            },
        ]
    }
]

# Which will be resolved into
$app->secrets( [ 'mySecret', 'myOldSecret' ] );
$app->sessions->cookie_name('appSession');
$app->sessions->default_expiration(1800);
$app->routes->get(
    '/foo'
        =>  {
                controller => 'controller',
                action     => 'do_foo'
            }
        => 'foo_action'
);
$app->routes->get(
    '/boo'
        =>  {
                controller => 'controller',
                action     => 'do_boo'
            }
        => 'boo_action'
);

DESCRIPTION

Configure application via config. Use app key in config file to configure your application.

There are some ref types to manage configuring flow.

AUTHOR

Dmitry "dim0xff" Latin <[email protected]>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Dmitry Latin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Easy setup your app via config

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages