summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-10-18 15:34:42 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-10-18 15:34:42 +0200
commit8957db765d0ffa076ce07061a3e16b7f4ebb81a4 (patch)
treec50fa747523a27e38dc21331eed730bcdaf440e3
parent63d6cc8180861abe66849382dc48c5d1f317f735 (diff)
index: override listen port/address via env
-rw-r--r--index.pl9
1 files changed, 4 insertions, 5 deletions
diff --git a/index.pl b/index.pl
index b67657f..7a6d018 100644
--- a/index.pl
+++ b/index.pl
@@ -18,10 +18,9 @@ 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=$host;port=$port",
+ my $host = $ENV{DBDB_HOST} // 'localhost';
+ my $port = $ENV{DBDB_PORT} // '5432';
+ my $dbh = DBI->connect( "dbi:Pg:dbname=$dbname;host=$host;port=$port",
'dbdb', $ENV{DBDB_PASSWORD}, { RaiseError => 1 } );
return $dbh;
@@ -815,7 +814,7 @@ get '/top' => sub {
app->config(
hypnotoad => {
accepts => 10,
- listen => ['http://*:8093'],
+ listen => [ $ENV{DBDB_LISTEN} // 'http://*:8093' ],
pid_file => '/tmp/dbdb.pid',
workers => $ENV{DBDB_WORKERS} // 2,
},