From 3a4fb1ccbb61c34dfb40697cfd8ba1fa178c1666 Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <erdnaxeli@gmail.com> Date: Mon, 10 Dec 2012 19:10:52 +0100 Subject: [PATCH] =?UTF-8?q?Utilisation=20d'un=20fichier=20de=20conf=20pour?= =?UTF-8?q?=20la=20connexion=20=C3=A0=20la=20bdd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PlayBot.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PlayBot.pl b/PlayBot.pl index 4ce7ec4..c3d4374 100755 --- a/PlayBot.pl +++ b/PlayBot.pl @@ -6,6 +6,7 @@ use POE::Component::IRC; use POSIX 'strftime'; use DBI; use Tie::File; +use JSON; use Logging; use youtube; @@ -42,9 +43,15 @@ if ($#ARGV + 1) { } +local $/; +open CONF, '<', 'playbot.conf'; +my $json = <CONF>; +my $conf = decode_json($json); + + ## CONNEXION my ($irc) = POE::Component::IRC->spawn(); -my $dbh = DBI->connect('DBI:mysql:assoce_nightiies;host=mysql.iiens.net', 'assoce_nightiies', 'POiREAU.jKNCFfBRq', { +my $dbh = DBI->connect('DBI:mysql:'.$conf->{'bdd'}.';host='.$conf->{'host'}, $conf->{'user'}, $conf->{'passwd'}, { PrintError => 0, AutoCommit => 1, mysql_auto_reconnect => 1 -- GitLab