From a1bb7bcda0069888fb580d0b7089bd9e3634de06 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 22 May 2009 22:54:01 -0400 Subject: [PATCH] Eliminate dependencies on any particular absolute path. Also, use pgcommitfest for database & database username, rather than commitfest and rhaas respectively. --- bin/server.fpl | 6 ++++-- etc/httpd.conf.template | 1 + perl-lib/PgCommitFest/Handler.pm | 4 ++-- perl-lib/PgCommitFest/Request.pm | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/server.fpl b/bin/server.fpl index ed4b347..5e5fc26 100755 --- a/bin/server.fpl +++ b/bin/server.fpl @@ -1,8 +1,10 @@ #!/usr/bin/perl -use lib '/home/rhaas/commitfest/perl-lib'; -use PgCommitFest::Handler; use strict; use warnings; +die "Must set PGCOMMITFEST_ROOT to root directory of installation!\n" + if !defined $ENV{'PGCOMMITFEST_ROOT'} || ! -d $ENV{'PGCOMMITFEST_ROOT'}; +unshift @INC, $ENV{'PGCOMMITFEST_ROOT'} . '/perl-lib'; +require PgCommitFest::Handler; PgCommitFest::Handler::main_loop(); diff --git a/etc/httpd.conf.template b/etc/httpd.conf.template index ba6b721..9425b42 100644 --- a/etc/httpd.conf.template +++ b/etc/httpd.conf.template @@ -2,6 +2,7 @@ DocumentRoot "BASEPATH/html" RewriteEngine On # Need mod_cgid installed and configured to handle .fpl files. + DefaultInitEnv PGCOMMITFEST_ROOT BASEPATH RewriteRule ^/$ BASEPATH/bin/server.fpl RewriteRule ^/action/ BASEPATH/bin/server.fpl diff --git a/perl-lib/PgCommitFest/Handler.pm b/perl-lib/PgCommitFest/Handler.pm index b2a32ad..13af0fd 100644 --- a/perl-lib/PgCommitFest/Handler.pm +++ b/perl-lib/PgCommitFest/Handler.pm @@ -27,8 +27,8 @@ our %ACTION = ( 'patch_comment_delete' => \&PgCommitFest::PatchComment::delete ); -our $PG = 'dbi:Pg:dbname=commitfest'; -our $PGUSERNAME = 'rhaas'; +our $PG = 'dbi:Pg:dbname=pgcommitfest'; +our $PGUSERNAME = 'pgcommitfest'; our $PGPASSWORD = ''; sub main_loop { diff --git a/perl-lib/PgCommitFest/Request.pm b/perl-lib/PgCommitFest/Request.pm index 7e3e878..4ceaf7f 100644 --- a/perl-lib/PgCommitFest/Request.pm +++ b/perl-lib/PgCommitFest/Request.pm @@ -7,7 +7,9 @@ require Template::Plugin::HTML; use strict; use warnings; -our $ROOT = '/home/rhaas/commitfest'; +die "Must set PGCOMMITFEST_ROOT to root directory of installation!\n" + if !defined $ENV{'PGCOMMITFEST_ROOT'} || ! -d $ENV{'PGCOMMITFEST_ROOT'}; +our $ROOT = $ENV{'PGCOMMITFEST_ROOT'}; our $template = Template->new({ 'INCLUDE_PATH' => $ROOT . '/template', 'FILTERS' => { 'htmlsafe' => \&PgCommitFest::WebControl::escape } }); $CGI::POST_MAX = 65536; -- 2.39.5