From 63d6cc8180861abe66849382dc48c5d1f317f735 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 16 Oct 2015 20:28:40 +0200 Subject: index: allow setting db host/port via env --- index.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3