[Rt-commit] rt branch, 4.4/rt-server-webpath, created. rt-4.4.1-85-gfef4c5d

Jim Brandt jbrandt at bestpractical.com
Thu Jul 21 11:15:00 EDT 2016


The branch, 4.4/rt-server-webpath has been created
        at  fef4c5d699d05f7f4539ee7de34c74a2f1fd7ac1 (commit)

- Log -----------------------------------------------------------------
commit fef4c5d699d05f7f4539ee7de34c74a2f1fd7ac1
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Thu Jul 21 11:13:54 2016 -0400

    Add a webpath option to rt-server
    
    Add --webpath to the rt-server test server to allow
    running the server and testing at /rt.

diff --git a/lib/RT/PlackRunner.pm b/lib/RT/PlackRunner.pm
index e30f4bd..e0a97de 100644
--- a/lib/RT/PlackRunner.pm
+++ b/lib/RT/PlackRunner.pm
@@ -73,6 +73,8 @@ sub parse_options {
     $self->{server} ||= $self->loader->guess;
 
     my %args = @{$self->{options}};
+    $self->{webpath} ||= $args{webpath} if $args{webpath};
+
     if ($self->{server} eq "FCGI") {
         # We deal with the possible failure modes of this in ->run
     } elsif ($args{port}) {
@@ -138,6 +140,13 @@ sub run {
         exit 1;
     }
 
+    if ( $self->{webpath} ){
+        require Plack::App::URLMap;
+        my $urlmap = Plack::App::URLMap->new;
+        $urlmap->map($self->{webpath} => $self->{app});
+        $self->{app} = $urlmap->to_app;
+    }
+
     eval { $self->SUPER::run(@_) };
     my $err = $@;
     exit 0 unless $err;
diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index fb4aed9..7df8625 100644
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -172,6 +172,9 @@ rt-server - RT standalone server
     # runs prefork server listening on port 8080, requires Starlet
     rt-server --port 8080
 
+    # runs prefork server listening on port 8080 at /rt
+    rt-server --port 8080 --webpath /rt
+
     # runs server listening on port 8080
     rt-server --server Standalone --port 8080
     # or

-----------------------------------------------------------------------


More information about the rt-commit mailing list