Moved the password configuration out into its own file.
authorSteinar H. Gunderson <sesse@debian.org>
Sun, 23 Jul 2006 18:22:55 +0000 (20:22 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Sun, 23 Jul 2006 18:22:55 +0000 (20:22 +0200)
.bzrignore
perl/Sesse/pr0n/Common.pm
perl/Sesse/pr0n/Config.pm [new file with mode: 0644]

index 6218e6c5aa6191e1f19bfd967b30a134c378b529..f8ef554dcd370cc21606c4d68d045963cf5dd934 100644 (file)
@@ -2,3 +2,4 @@ images/*
 cache/*
 backup
 lost+found
 cache/*
 backup
 lost+found
+Config_local.pm
index f91526001efcea11858a187b0db1bea2bcdf6922..e545e91d9e5a06704a2bc30baf949a3badaf95dd 100644 (file)
@@ -26,13 +26,19 @@ BEGIN {
        use Exporter ();
        our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
 
        use Exporter ();
        our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
 
+       use Sesse::pr0n::Config;
+       eval {
+               require Sesse::pr0n::Config_local;
+       };
+
        $VERSION     = "v2.04";
        @ISA         = qw(Exporter);
        @EXPORT      = qw(&error &dberror);
        %EXPORT_TAGS = qw();
        @EXPORT_OK   = qw(&error &dberror);
 
        $VERSION     = "v2.04";
        @ISA         = qw(Exporter);
        @EXPORT      = qw(&error &dberror);
        %EXPORT_TAGS = qw();
        @EXPORT_OK   = qw(&error &dberror);
 
-       our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")
+       our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+               $Sesse::pr0n::Config::db_username, $Sesse::pr0n::Config::db_password)
                or die "Couldn't connect to PostgreSQL database: " . DBI->errstr;
        our $mimetypes = new MIME::Types;
        
                or die "Couldn't connect to PostgreSQL database: " . DBI->errstr;
        our $mimetypes = new MIME::Types;
        
@@ -134,7 +140,8 @@ sub get_dbh {
        if (!(defined($dbh) && $dbh->ping)) {
                # Try to reconnect
                Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
        if (!(defined($dbh) && $dbh->ping)) {
                # Try to reconnect
                Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
-               unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")) {
+               unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+                       $Sesse::pr0n::Config::db_user, $Sesse::pr0n::Config::db_password)) {
                        $dbh = undef;
                        die "Couldn't connect to PostgreSQL database";
                }
                        $dbh = undef;
                        die "Couldn't connect to PostgreSQL database";
                }
diff --git a/perl/Sesse/pr0n/Config.pm b/perl/Sesse/pr0n/Config.pm
new file mode 100644 (file)
index 0000000..e267c99
--- /dev/null
@@ -0,0 +1,17 @@
+# 
+# Copy this file to Config-local.pm and change the values there to
+# suit your own needs.
+#
+# Note that most configuration is done in your vhost; this isn't,
+# because it's persistent between sessions and we don't have access
+# to the Apache configuration data then.
+#
+package Sesse::pr0n::Config;
+use strict;
+use warnings;
+
+our $db_host = '127.0.0.1';
+our $db_username = 'pr0n';
+our $db_password = '';
+
+1;