Skip to content

Commit

Permalink
Remove y18n due to CVE 2020 7774 part 5 (#1112)
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Gilman <sgilman@veracode.com>
  • Loading branch information
thenengah and Sam Gilman committed May 31, 2021
1 parent 1f6108e commit 35a4062
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 33 deletions.
10 changes: 5 additions & 5 deletions lib/forever.js
Expand Up @@ -13,7 +13,7 @@ const events = require("events");
const exec = require("child_process").exec;
const spawn = require("child_process").spawn;
const cliff = require("cliff");
const nconf = require("nconf");
const Configstore = require('configstore');
const nssocket = require("nssocket");
const utils = require("./util/utils");
const winston = require("winston");
Expand Down Expand Up @@ -307,16 +307,16 @@ forever.load = function (options) {
return;
}

forever.config = new nconf.File({ file: path.join(options.root, 'config.json') });

//
// Try to load the forever `config.json` from
// the specified location.
//
try {
forever.config.loadSync();
forever.config = new Configstore(JSON.parse(fs.readFileSync(path.join(options.root, 'config.json'))));
}
catch (ex) {
forever.config = new Configstore();
}
catch (ex) { }

//
// Setup the columns for `forever list`.
Expand Down
8 changes: 6 additions & 2 deletions lib/util/config-utils.js
@@ -1,9 +1,13 @@
var path = require('path');
var fs = require('fs');
var nconf = require('nconf');
var Configstore = require('configstore');

function initConfigFile(foreverRoot) {
return new nconf.File({file: path.join(foreverRoot, 'config.json')});
try {
return new Configstore(JSON.parse(fs.readFileSync(path.join(foreverRoot, 'config.json'))));
} catch (err) {
return new Configstore()
}
}

//
Expand Down
96 changes: 71 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,11 +22,11 @@
"cliff": "^0.1.10",
"clone": "^2.1.2",
"colors": "^0.6.2",
"configstore": "4.0.0",
"eventemitter2": "6.4.3",
"flatiron": "~0.4.3",
"forever-monitor": "^3.0.3",
"mkdirp": "^0.5.5",
"nconf": "^0.10.0",
"nssocket": "^0.6.0",
"object-assign": "^4.1.1",
"prettyjson": "^1.2.1",
Expand Down

0 comments on commit 35a4062

Please sign in to comment.