Browse Source

Externalized configuration (#3855).

master
Christian P. MOMON 2 years ago
committed by root
parent
commit
2eed7a8c21
  1. 25
      alexandrie
  2. 15
      alexandrie.conf
  3. 11
      parse_known_sites

25
alexandrie

@ -5,20 +5,27 @@ use warnings;
use POE qw(Component::IRC);
use List::MoreUtils qw(any);
use DBI;
use Config::Simple;
my $parser = '/srv/alexandrie/parse_known_sites';
# CONFIGURATION FILE
my $alexandrieConf = new Config::Simple("/etc/alexandrie/alexandrie.conf") or die "Missing configuration file.";
print "Configuration file loaded.\n";
# PARSER
my $parser = $alexandrieConf->param("parser.path");
# DATABASE
my $dsn = 'DBI:mysql:drupal6:172.16.0.7';
my $db_user_name = 'drupal';
my $db_password = 'xxxxxxx';
my $dbh = 0;
my $dsn = $alexandrieConf->param("database.dsn");
my $db_user_name = $alexandrieConf->param("database.username");
my $db_password = $alexandrieConf->param("database.password");
my $dbh = $alexandrieConf->param("database.dbh");
# IRC
my $nickname = 'alexandrie';
my $ircname = 'Bibliothèque de l\'April';
my $server = 'irc.freenode.net';
my $username = 'alex';
my $nickname = $alexandrieConf->param("irc.nickname");
my $ircname = $alexandrieConf->param("irc.name");
my $server = $alexandrieConf->param("irc.server");
my $username = $alexandrieConf->param("irc.username");
my @channels = ('#april', '#april-alexandrie');
#my @channels = ('#april-alexandrie');

15
alexandrie.conf

@ -0,0 +1,15 @@
[parser]
path=/srv/alexandrie/parse_known_sites
[database]
dsn=DBI:mysql:drupal6:172.16.0.7
username= drupal
password=xxxxxxxx
dbh = 0;
[irc]
nickname=alexandrie
name=Bibliothèque de l\'April
server=irc.freenode.net
username=alex
channels=#april,#april-alexandrie

11
parse_known_sites

@ -9,11 +9,16 @@
use strict;
use LWP::Simple;
use DBI;
use Config::Simple;
my $dsn = 'DBI:mysql:drupal6:172.16.0.7';
my $db_user_name = 'drupal';
my $db_password = 'xxxxxxx';
# CONFIGURATION FILE
my $alexandrieConf = new Config::Simple("/etc/alexandrie/alexandrie.conf") or die "Missing configuration file.";
print "Configuration file loaded.\n";
# DATABASE
my $dsn = $alexandrieConf->param("database.dsn");
my $db_user_name = $alexandrieConf->param("database.username");
my $db_password = $alexandrieConf->param("database.password");
sub parse_page

Loading…
Cancel
Save