Changeset 25 for trunk/dnsbl/DNSBL.pm


Ignore:
Timestamp:
09/03/10 15:18:51 (14 years ago)
Author:
Kris Deugau
Message:

/trunk/dnsbl

Changes across the board to support multi-instance without code changes.
DB config is now loaded from a fragment in /etc/dnsbl, and the DB in turn
contains the autolist thresholds and some visual sugar for the web
interface so you know which DB you're dealing with.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dnsbl/DNSBL.pm

    r24 r25  
    100100sub DESTROY {
    101101  my $self = shift;
    102   $self->dbclose();
     102  $self->dbclose() if $dbh;
    103103}
    104104
     
    112112
    113113sub connect {
    114   my $DSN = "DBI:Pg:host=dbhost;dbname=dnsbl";
    115 #  my $DSN = "DBI:Pg:dbname=dnsbl";
    116   my $user = "dnsbl";
    117   my $pass = "spambgone";
     114  my $self = shift;
     115  my $dbhost = shift;
     116  my $dbname = shift;
     117  my $dbuser = shift;
     118  my $dbpass = shift;
    118119  ## want to NOT autocommit everything, it's unlikely we'll step on our own toes but...
    119   $dbh = DBI->connect($DSN, $user, $pass, {
     120  $dbh = DBI->connect("DBI:Pg:host=$dbhost;dbname=$dbname", $dbuser, $dbpass, {
    120121        AutoCommit => 0,
    121122        PrintError => 1
Note: See TracChangeset for help on using the changeset viewer.