NAME
Kelp::Module::Config - Configuration for Kelp applications
DESCRIPTION
This is one of the two modules that are automatically loaded for each and every Kelp application. It uses Config::Hash to read Perl-style hashes from files and merge them depending on the value of the mode
attribute.
The main configuration file name is config.pl
, and it will be searched in the conf
directory or ../conf
. The latter is convenient for running tests which use the same configuration settings as the main app.
REGISTERED METHODS
This module registers the following methods into the underlying app:
config
A wrapper for the get
method in Config::Hash.
# Somewhere in the app
my $pos = $self->config('row.col.position');
# Gets {row}->{col}->{position} from the config hash
config_hash
A reference to the entire configuration hash.
my $pos = $self->config_hash->{row}->{col}->{position};
Using this or config
is entirely up to the application developer.
DEFAULTS
This module sets certain default values. All of them may be overridden in any of the conf/
files. It probably pays to view the code of this module and look and the defaults
sub to see what is being set by default, but here is the short version:
charset
UTF-8
app_url
http://localhost:5000
modules
An arrayrf with module names to load on startup. The default value is ['JSON', 'Template', 'Logger']
modules_init
A hashref with initializations for each of the loaded modules, except this one, ironically.
middleware
An arrayref with middleware to load on startup. The default value is an empty array.
middleware_init
A hashref with iitialization arguments for each of the loaded middleware.