enable use of MSVA_PORT environment variable to choose the port
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 9 Mar 2010 03:58:46 +0000 (22:58 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 9 Mar 2010 03:58:46 +0000 (22:58 -0500)
msva

diff --git a/msva b/msva
index 3b5ce80f18776eab9c5d14b6f4f18e4530247a77..fec119c15a44beb3fd833a756e746ae5e37d2fe8 100755 (executable)
--- a/msva
+++ b/msva
@@ -85,8 +85,14 @@ use strict;
 
   sub new {
     my $class = shift;
+
+    my $port = 8901;
+    if (exists $ENV{MSVA_PORT}) {
+      $port = $ENV{MSVA_PORT} + 0;
+      die sprintf("not a reasonable port %d", $port) if (($port >= 65536) || $port <= 0);
+    }
     # start the server on port 8901
-    my $self = $class->SUPER::new(8901);
+    my $self = $class->SUPER::new($port);
 
     $self->{allowed_uids} = {};
     if (exists $ENV{MSVA_ALLOWED_USERS}) {