Acrux
view release on metacpan or search on metacpan
lib/Acme/Crux/Plugin/Config.pm view on Meta::CPAN
package Acme::Crux::Plugin::Config;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Crux::Plugin::Config - The Acme::Crux plugin for configuration your application
=head1 SYNOPSIS
# In startup
my $config = $app->plugin('Config');
my $config = $app->plugin('Config', undef, {file => '/etc/myapp.conf'});
# In application
my $val = $app->config->get("/foo/bar/baz");
my $all = $app->config->conf;
my $array = $app->config->array('/foo'); # 'value'
# ['value']
my $hash = $app->config->hash('/foo'); # { foo => 'first', bar => 'second' }
# { foo => 'first', bar => 'second' }
my $first = $app->config->first('/foo'); # ['first', 'second', 'third']
# first
my $latest = $app->config->latest('/foo'); # ['first', 'second', 'third']
# third
=head1 DESCRIPTION
The Acme::Crux plugin for configuration your application
=head1 OPTIONS
This plugin supports the following options
=head2 default
$app->plugin(Config => undef, {default => {foo => 'bar'});
Sets the default configuration hash
Default: no defaults, empty config structure
=head2 dirs
$app->plugin(Config => undef, {dirs => ['/etc/foo', '/etc/bar']});
Paths to additional directories of config files
Default: no additional directories
=head2 file
$app->plugin(Config => undef, {file => '/etc/myapp.conf'});
Path to configuration file, absolute or relative to the application root directory,
defaults to the value of the C<$moniker.conf> in the application root directory.
( run in 2.316 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )