From: Steinar H. Gunderson Date: Sun, 23 Jul 2006 18:22:55 +0000 (+0200) Subject: Moved the password configuration out into its own file. X-Git-Url: https://git.sesse.net/?p=pr0n;a=commitdiff_plain;h=3190115fc3d69debf06c037528bfa98fe4cfdc96 Moved the password configuration out into its own file. --- diff --git a/.bzrignore b/.bzrignore index 6218e6c..f8ef554 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,3 +2,4 @@ images/* cache/* backup lost+found +Config_local.pm diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index f915260..e545e91 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -26,13 +26,19 @@ BEGIN { 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); - 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; @@ -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..."); - 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"; } diff --git a/perl/Sesse/pr0n/Config.pm b/perl/Sesse/pr0n/Config.pm new file mode 100644 index 0000000..e267c99 --- /dev/null +++ b/perl/Sesse/pr0n/Config.pm @@ -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;