diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/DaemonControl.pm | 3 | ||||
-rw-r--r-- | Bugzilla/Quantum.pm | 25 |
2 files changed, 27 insertions, 1 deletions
diff --git a/Bugzilla/DaemonControl.pm b/Bugzilla/DaemonControl.pm index 43461b5ec..aae06f9f7 100644 --- a/Bugzilla/DaemonControl.pm +++ b/Bugzilla/DaemonControl.pm @@ -23,6 +23,7 @@ use IO::Async::Protocol::LineStream; use IO::Async::Signal; use IO::Socket; use LWP::Simple qw(get); +use JSON::MaybeXS qw(encode_json); use POSIX qw(setsid WEXITSTATUS); use base qw(Exporter); @@ -103,7 +104,7 @@ sub run_httpd { # we have to setsid() to make a new process group # or else apache will kill its parent. setsid(); - warn "ignoring args: @args"; + $ENV{BUGZILLA_HTTPD_ARGS} = encode_json(\@args); my @command = ( $^X, '/app/scripts/bugzilla_quantum', 'daemon', "--listen=http://*:$ENV{PORT}" ); exec @command or die "failed to exec $command[0] $!"; diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm index 299b4bf42..7d679e3c3 100644 --- a/Bugzilla/Quantum.pm +++ b/Bugzilla/Quantum.pm @@ -22,6 +22,7 @@ use Bugzilla::Extension (); use Bugzilla::Install::Requirements (); use Bugzilla::Util (); use Bugzilla::RNG (); +use JSON::MaybeXS qw(decode_json); use Cwd qw(realpath); use MojoX::Log::Log4perl::Tiny; @@ -30,6 +31,30 @@ has 'static' => sub { Bugzilla::Quantum::Static->new }; sub startup { my ($self) = @_; + my %D; + if ($ENV{BUGZILLA_HTTPD_ARGS}) { + my $args = decode_json($ENV{BUGZILLA_HTTPD_ARGS}); + foreach my $arg (@$args) { + if ($arg =~ /^-D(\w+)$/) { + $D{$1} = 1; + } + else { + die "Unknown httpd arg: $arg"; + } + } + } + + $self->hook( + before_dispatch => sub { + my $c = shift; + + if ($D{HTTPD_IN_SUBDIR}) { + my $path = $c->req->url->path; + $path =~ s{^/bmo}{}s; + $c->req->url->path($path); + } + } + ); my $extensions = Bugzilla::Extension->load_all(); Bugzilla->preload_features(); |