Skip to content
Snippets Groups Projects
Commit 334aec1e authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

allow database connection options in configuration

parent bf15cbfa
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,8 @@ AccountManager::DB->register_db(
database => $configuration->{database}->{name},
host => $configuration->{database}->{host},
password => $configuration->{database}->{password},
username => $configuration->{database}->{username}
username => $configuration->{database}->{username},
options => [ split(/, */, $configuration->{database}->{options}) ]
);
my $db = AccountManager::DB->new();
......
......@@ -23,6 +23,7 @@ host = localhost
name = idp_account_manager
username = idpadmin
password = secret
options = mysql_enable_utf8
[idp]
scope = my.fqdn
......
......@@ -96,6 +96,7 @@ sub new {
host => $self->{configuration}->{database}->{host},
username => $self->{configuration}->{database}->{username},
password => $self->{configuration}->{database}->{password},
options => [ split(/, */, $self->{configuration}->{database}->{options}) ]
);
} else {
$self->{logger}->fatal(
......
......@@ -8,7 +8,6 @@ use base 'Rose::DB';
__PACKAGE__->use_private_registry;
__PACKAGE__->SUPER::register_db (
connect_options => { AutoCommit => 1, ChopBlanks => 1 },
driver => 'mysql',
host => 'localhost',
database => 'fake',
......@@ -19,8 +18,16 @@ __PACKAGE__->SUPER::register_db (
sub register_db {
my ($pkg, %args) = @_;
my $options = {
AutoCommit => 1,
ChopBlanks => 1,
};
if ($args{options}) {
$options->{$_} = 1 foreach @{$args{options}};
}
__PACKAGE__->SUPER::register_db (
connect_options => { AutoCommit => 1, ChopBlanks => 1 },
connect_options => $options,
driver => $args{driver},
host => $args{host},
database => $args{database},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment