The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Config::ENV - Various config determined by %ENV

SYNOPSIS

package MyConfig;

use Config::ENV 'PLACK_ENV'; # use $ENV{PLACK_ENV} to determine config

common +{
  name => 'foobar',
};

config development => +{
  dsn_user => 'dbi:mysql:dbname=user;host=localhost',
};

config test => +{
  dsn_user => 'dbi:mysql:dbname=user;host=localhost',
};

config production => +{
  dsn_user => 'dbi:mysql:dbname=user;host=127.0.0.254',
};

config production_bot => +{
  parent('production'),
  bot => 1,
};

# Use it

use MyConfig;
MyConfig->param('dsn_user'); #=> ...

DESCRIPTION

Config::ENV is for switching various configurations by environment variable.

CONFIG DEFINITION

use this module in your config package:

package MyConfig;
use Config::ENV 'FOO_ENV';

common +{
  name => 'foobar',
};

config development => +{};
config production  => +{};

1;

EXPORT

You can specify default export name in config class. If you specify 'export' option as following:

package MyConfig;
use Config::ENV 'FOO_ENV', export => 'config';

...;

and use it with 'config' function.

package Foobar;
use MyConfig; # exports 'config' function

config->param('...');

METHODS

AUTHOR

cho45 cho45@lowreal.net

SEE ALSO

LICENSE

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