Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
c6363140
Commit
c6363140
authored
Feb 25, 2017
by
Dylan William Hardison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1272673 - make app.psgi runnable
parent
dfb68886
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
12 deletions
+38
-12
README.rst
README.rst
+1
-1
app.psgi
app.psgi
+37
-11
No files found.
README.rst
View file @
c6363140
...
@@ -53,7 +53,7 @@ Finally, a webserver can be started by the following:
...
@@ -53,7 +53,7 @@ Finally, a webserver can be started by the following:
.. code-block:: bash
.. code-block:: bash
perl
-Ilocal/lib/perl5 local/bin/plackup
perl
app.psgi
Navigate to http://localhost:5000/ and login with the username and password provided earlier to checksetup.
Navigate to http://localhost:5000/ and login with the username and password provided earlier to checksetup.
Remember to set the urlbase on http://localhost:5000/editparams.cgi. "http://localhost:5000" will probably suffice.
Remember to set the urlbase on http://localhost:5000/editparams.cgi. "http://localhost:5000" will probably suffice.
...
...
app.psgi
View file @
c6363140
...
@@ -12,10 +12,19 @@ use warnings;
...
@@ -12,10 +12,19 @@ use warnings;
use
File::
Basename
;
use
File::
Basename
;
use
File::
Spec
;
use
File::
Spec
;
BEGIN
{
BEGIN
{
require
lib
;
require
lib
;
my
$dir
=
dirname
(
__FILE__
);
my
$dir
=
File::
Spec
->
rel2abs
(
dirname
(
__FILE__
)
);
lib
->
import
(
$dir
,
File::
Spec
->
catdir
(
$dir
,
"lib"
),
File::
Spec
->
catdir
(
$dir
,
qw(local lib perl5)
));
lib
->
import
(
$dir
,
File::
Spec
->
catdir
(
$dir
,
"lib"
),
File::
Spec
->
catdir
(
$dir
,
qw(local lib perl5)
)
);
# disable "use lib" from now on
no
warnings
qw(redefine)
;
*
lib::
import
=
sub
{
};
}
}
use
Bugzilla::
Constants
();
use
Bugzilla::
Constants
();
...
@@ -37,8 +46,9 @@ use constant STATIC => qw(
...
@@ -37,8 +46,9 @@ use constant STATIC => qw(
skins
skins
)
;
)
;
builder
{
my
$app
=
builder
{
my
$static_paths
=
join
(
'|'
,
STATIC
);
my
$static_paths
=
join
(
'|'
,
sort
{
length
$b
<=>
length
$a
||
$a
cmp
$b
}
STATIC
);
enable
'Static'
,
enable
'Static'
,
path
=>
qr{^/($static_paths)/}
,
path
=>
qr{^/($static_paths)/}
,
root
=>
Bugzilla::Constants::
bz_locations
->
{
cgi_path
};
root
=>
Bugzilla::Constants::
bz_locations
->
{
cgi_path
};
...
@@ -48,10 +58,13 @@ builder {
...
@@ -48,10 +58,13 @@ builder {
my
$map
=
Plack::App::
URLMap
->
new
;
my
$map
=
Plack::App::
URLMap
->
new
;
my
@cgis
=
glob
(
'*.cgi'
);
my
@cgis
=
glob
(
'*.cgi'
);
my
$shutdown_app
=
Plack::App::
WrapCGI
->
new
(
script
=>
'shutdown.cgi'
)
->
to_app
;
my
$shutdown_app
=
Plack::App::
WrapCGI
->
new
(
script
=>
'shutdown.cgi'
)
->
to_app
;
foreach
my
$cgi_script
(
@cgis
)
{
foreach
my
$cgi_script
(
@cgis
)
{
my
$app
=
eval
{
Plack::App::
WrapCGI
->
new
(
script
=>
$cgi_script
)
->
to_app
};
my
$app
=
eval
{
Plack::App::
WrapCGI
->
new
(
script
=>
$cgi_script
)
->
to_app
};
# Some CGI scripts won't compile if not all optional Perl modules are
# Some CGI scripts won't compile if not all optional Perl modules are
# installed. That's expected.
# installed. That's expected.
if
(
$@
)
{
if
(
$@
)
{
...
@@ -61,15 +74,28 @@ builder {
...
@@ -61,15 +74,28 @@ builder {
my
$wrapper
=
sub
{
my
$wrapper
=
sub
{
my
$ret
=
Bugzilla::
init_page
();
my
$ret
=
Bugzilla::
init_page
();
my
$res
=
(
$ret
eq
'-1'
&&
$cgi_script
ne
'editparams.cgi'
)
?
$shutdown_app
->
(
@_
)
:
$app
->
(
@_
);
my
$res
=
(
$ret
eq
'-1'
&&
$cgi_script
ne
'editparams.cgi'
)
?
$shutdown_app
->
(
@_
)
:
$app
->
(
@_
);
Bugzilla::
_cleanup
();
Bugzilla::
_cleanup
();
return
$res
;
return
$res
;
};
};
my
$base_name
=
basename
(
$cgi_script
);
my
$base_name
=
basename
(
$cgi_script
);
$map
->
map
(
'/'
=>
$wrapper
)
if
$cgi_script
eq
'index.cgi'
;
$map
->
map
(
'/'
=>
$wrapper
)
if
$cgi_script
eq
'index.cgi'
;
$map
->
map
(
'/rest'
=>
$wrapper
)
if
$cgi_script
eq
'rest.cgi'
;
$map
->
map
(
'/rest'
=>
$wrapper
)
if
$cgi_script
eq
'rest.cgi'
;
$map
->
map
(
"/$base_name"
=>
$wrapper
);
$map
->
map
(
"/$base_name"
=>
$wrapper
);
}
}
my
$app
=
$map
->
to_app
;
$map
->
to_app
;
};
};
unless
(
caller
)
{
require
Plack::
Runner
;
my
$runner
=
Plack::
Runner
->
new
;
$runner
->
parse_options
(
@ARGV
);
$runner
->
run
(
$app
);
exit
0
;
}
return
$app
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment