mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
feature: allow to set deep monitoring via environment (PM2_DEEP_MONITORING=true on start/restart)
This commit is contained in:
parent
748019d1ef
commit
eb39c5f697
@ -668,6 +668,10 @@ API.prototype._startScript = function(script, opts, cb) {
|
||||
else
|
||||
app_conf.exec_mode = 'fork';
|
||||
|
||||
// Options set via environment variables
|
||||
if (process.env.PM2_DEEP_MONITORING)
|
||||
app_conf.deep_monitoring = true;
|
||||
|
||||
if (typeof app_conf.name == 'function'){
|
||||
delete app_conf.name;
|
||||
}
|
||||
@ -1450,6 +1454,10 @@ API.prototype._handleAttributeUpdate = function(opts) {
|
||||
delete appConf.watch
|
||||
}
|
||||
|
||||
// Options set via environment variables
|
||||
if (process.env.PM2_DEEP_MONITORING)
|
||||
appConf.deep_monitoring = true;
|
||||
|
||||
// Force deletion of defaults values set by commander
|
||||
// to avoid overriding specified configuration by user
|
||||
if (appConf.treekill === true)
|
||||
|
||||
24
test/bash/options-via-env.sh
Normal file
24
test/bash/options-via-env.sh
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SRC=$(cd $(dirname "$0"); pwd)
|
||||
source "${SRC}/include.sh"
|
||||
|
||||
cd $file_path
|
||||
|
||||
# With start
|
||||
$pm2 start echo.js
|
||||
should 'should deep_monitoring' 'deep_monitoring' 0
|
||||
|
||||
$pm2 delete all
|
||||
|
||||
PM2_DEEP_MONITORING=true $pm2 start echo.js
|
||||
should 'should deep_monitoring' 'deep_monitoring' 1
|
||||
|
||||
$pm2 delete all
|
||||
|
||||
# With restart
|
||||
$pm2 start echo.js
|
||||
should 'should deep_monitoring' 'deep_monitoring' 0
|
||||
PM2_DEEP_MONITORING=true $pm2 restart echo
|
||||
should 'should deep_monitoring' 'deep_monitoring' 1
|
||||
@ -23,6 +23,8 @@ bash ./test/bash/pm2-dev.sh
|
||||
spec "pm2-dev"
|
||||
bash ./test/bash/pm2-runtime.sh
|
||||
spec "pm2-runtime"
|
||||
bash ./test/bash/options-via-env.sh
|
||||
spec "set option via environment"
|
||||
bash ./test/bash/startup.sh
|
||||
spec "upstart startup test"
|
||||
bash ./test/bash/dump.sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user