Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Coxify::Db;
- use base qw(Rose::DB);
- use File::Slurp;
- use Mojo::JSON;
- my $_config = undef;
- sub config {
- my ($key) = @_;
- unless ($_config) {
- my $json = Mojo::JSON->new;
- $_config = $json->decode(read_file('config/config.json', binmode => ':utf8')) ;
- }
- return $_config->{key};
- }
- __PACKAGE__->register_db(
- driver => config('driver'),
- database => config('database'),
- host => config('host'),
- username => config('username'),
- password => config('password'),
- );
- 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement