Verified Commit dc644840 authored by Aral Balkan's avatar Aral Balkan
Browse files

Add --info proxy for pm2 show web-server

parent 93c47336
...@@ -19,6 +19,7 @@ if (arguments._.length > 2 || arguments.help === true) { ...@@ -19,6 +19,7 @@ if (arguments._.length > 2 || arguments.help === true) {
const usageLiveOption = `${clr('--live', 'yellow')}` const usageLiveOption = `${clr('--live', 'yellow')}`
const usageMonitorOption = `${clr('--monitor', 'yellow')}` const usageMonitorOption = `${clr('--monitor', 'yellow')}`
const usageLogsOption = `${clr('--logs', 'yellow')}` const usageLogsOption = `${clr('--logs', 'yellow')}`
const usageInfoOption = `${clr('--info', 'yellow')}`
const usageVersionOption = `${clr('--version', 'yellow')}` const usageVersionOption = `${clr('--version', 'yellow')}`
const usage = ` const usage = `
...@@ -31,8 +32,9 @@ if (arguments._.length > 2 || arguments.help === true) { ...@@ -31,8 +32,9 @@ if (arguments._.length > 2 || arguments.help === true) {
${usagePortOption}\t\tThe port to start the server on (defaults to 443). ${usagePortOption}\t\tThe port to start the server on (defaults to 443).
${usageStagingOption}\t\tRun as regular process with globally-trusted certificates. ${usageStagingOption}\t\tRun as regular process with globally-trusted certificates.
${usageLiveOption}\t\tRun as launch-time daemon with globally-trusted certificates. ${usageLiveOption}\t\tRun as launch-time daemon with globally-trusted certificates.
${usageMonitorOption}\t\tMonitor an already-running live server. ${usageMonitorOption}\t\tMonitor the running live server.
${usageLogsOption}\t\tDisplay and tail the server logs. ${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. ${usageVersionOption}\t\tDisplay the version.
`.replace(/\n$/, '').replace(/^\n/, '') `.replace(/\n$/, '').replace(/^\n/, '')
...@@ -80,6 +82,23 @@ if (arguments.logs !== undefined) { ...@@ -80,6 +82,23 @@ if (arguments.logs !== undefined) {
process.exit(0) 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 no path is passed, serve the current folder.
// If there is a path, serve that. // If there is a path, serve that.
let pathToServe = '.' let pathToServe = '.'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment