Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Site.js
app
Commits
dc644840
Verified
Commit
dc644840
authored
Mar 31, 2019
by
Aral Balkan
Browse files
Add --info proxy for pm2 show web-server
parent
93c47336
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/web-server.js
View file @
dc644840
...
...
@@ -19,6 +19,7 @@ if (arguments._.length > 2 || arguments.help === true) {
const
usageLiveOption
=
`
${
clr
(
'
--live
'
,
'
yellow
'
)}
`
const
usageMonitorOption
=
`
${
clr
(
'
--monitor
'
,
'
yellow
'
)}
`
const
usageLogsOption
=
`
${
clr
(
'
--logs
'
,
'
yellow
'
)}
`
const
usageInfoOption
=
`
${
clr
(
'
--info
'
,
'
yellow
'
)}
`
const
usageVersionOption
=
`
${
clr
(
'
--version
'
,
'
yellow
'
)}
`
const
usage
=
`
...
...
@@ -31,8 +32,9 @@ if (arguments._.length > 2 || arguments.help === true) {
•
${
usagePortOption
}
\t\tThe port to start the server on (defaults to 443).
•
${
usageStagingOption
}
\t\tRun as regular process with globally-trusted certificates.
•
${
usageLiveOption
}
\t\tRun as launch-time daemon with globally-trusted certificates.
•
${
usageMonitorOption
}
\t\tMonitor an already-running live server.
•
${
usageLogsOption
}
\t\tDisplay and tail the server logs.
•
${
usageMonitorOption
}
\t\tMonitor the running live server.
•
${
usageLogsOption
}
\t\tDisplay and tail the server logs for the running live server.
•
${
usageInfoOption
}
\t\tDisplay detailed information about the running live server.
•
${
usageVersionOption
}
\t\tDisplay the version.
`
.
replace
(
/
\n
$/
,
''
).
replace
(
/^
\n
/
,
''
)
...
...
@@ -80,6 +82,23 @@ if (arguments.logs !== undefined) {
process
.
exit
(
0
)
}
// Info (pm2 proxy).
if
(
arguments
.
info
!==
undefined
)
{
// Launch pm2 logs.
const
options
=
{
env
:
process
.
env
,
stdio
:
'
inherit
'
}
try
{
childProcess
.
execSync
(
`sudo
${
pm2Path
}
show web-server`
,
options
)
}
catch
(
error
)
{
console
.
log
(
` 👿 Failed to show detailed information on the web server.\n`
)
process
.
exit
(
1
)
}
process
.
exit
(
0
)
}
// If no path is passed, serve the current folder.
// If there is a path, serve that.
let
pathToServe
=
'
.
'
...
...
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