feature: pm2 internal config

This commit is contained in:
Unitech 2018-09-27 17:24:24 +02:00
parent 61745d305f
commit 88b3abc985
3 changed files with 25 additions and 1 deletions

View File

@ -26,7 +26,8 @@ var path_structure = require('../paths.js');
var UX = require('./API/CliUx');
var pkg = require('../package.json');
var flagWatch = require("./API/Modules/flagWatch.js");
var hf = require('./API/Modules/flagExt.js');
var hf = require('./API/Modules/flagExt.js');
var Configuration = require('./Configuration.js');
var IMMUTABLE_MSG = chalk.bold.blue('Use --update-env to update environment variables');
@ -94,6 +95,7 @@ class API {
conf = util._extend(conf, path_structure(this.pm2_home));
}
this.user_conf = Configuration.getSync('pm2')
this._conf = conf;
if (conf.IS_WINDOWS) {

View File

@ -0,0 +1,20 @@
const PM2 = require('../..');
const should = require('should');
describe('Internal PM2 configuration', function() {
var pm2
before(function() {
pm2 = new PM2.custom();
})
it('should set pm2:registry', function(done) {
pm2.set('pm2:registry', 'http://thing.com', done)
})
it('should new instance have the configuration', function() {
var pm3 = new PM2.custom();
should(pm2.user_conf.registry).eql('http://thing.com')
})
})

View File

@ -52,6 +52,8 @@ mocha --exit --opts ./mocha.opts ./version.mocha.js
spec "Package json version retriever"
mocha --exit --opts ./mocha.opts ./exp_backoff_restart_delay.mocha.js
spec "Exponential backoff restart delay tests"
mocha --exit --opts ./mocha.opts ./internal_config.mocha.js
spec "PM2 local configuration working"
mocha --exit --opts ./mocha.opts ./api.backward.compatibility.mocha.js
spec "API Backward compatibility tests"