Perl port of the Ruby Konfa configuration interface.
Konfa aims to solve some of the common mishaps related to application configration such as:
- Bugs attributed to misspelt configuration variable names
- Forgotten configuration options that nobody knows what they do or where they are used
- Seamlessly reading configuration values from either the environment or YAML (or any other source for that matter)
package AppConfig;
use parent 'Konfa';
sub env_variable_prefix { 'APP_' }
sub allowed_variables {
{
'api_key' => undef,
'feature_enabled' => 'yes',
}
}
# -- Later on --
AppConfig->init_with_env;
# -- Even later --
use AppConfig vars => 'config';
if(config->is_feature_enabled) {
# do what is needed
}
See the module documentation for more examples and complete API reference.
Because Konfa is not (yet) on CPAN, it has to be manually installed (assuming Module::Build is available):
git clone [email protected]:avidity/konfa-perl
cd konfa-perl
perl Build.pl
./Build installdeps
./Build test
./Build install
This is free software. Like Perl 5, you can redistribute it and/or modify it under the terms of either
a) the GNU General Public License;
b) the "Artistic License".
See LICENSE for full license text.