summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-10-16 20:28:40 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-10-16 20:28:40 +0200
commit63d6cc8180861abe66849382dc48c5d1f317f735 (patch)
treed6bee28fe0fd4a6480347c086f2a41d6314394a4
parentd9961e3a1ed5b932087b77ad886dbb4114a1672b (diff)
index: allow setting db host/port via env
-rw-r--r--index.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/index.pl b/index.pl
index 31b86a0..b67657f 100644
--- a/index.pl
+++ b/index.pl
@@ -18,8 +18,10 @@ app->attr(
my $self = shift;
my $dbname = 'dbdb';
+ my $host = $ENV{DBDB_HOST} // 'localhost';
+ my $port = $ENV{DBDB_PORT} // '5432';
my $dbh
- = DBI->connect( "dbi:Pg:dbname=$dbname;host=localhost;port=5432",
+ = DBI->connect( "dbi:Pg:dbname=$dbname;host=$host;port=$port",
'dbdb', $ENV{DBDB_PASSWORD}, { RaiseError => 1 } );
return $dbh;