haraka-config
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"env": { | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"plugins": [ | ||
"haraka" | ||
], | ||
"installedESLint": true, | ||
"root": true, | ||
"extends": ["eslint:recommended", "plugin:haraka/recommended"], | ||
"rules": { | ||
"comma-dangle": [2, "only-multiline"], | ||
"dot-notation": 2, | ||
"indent": [2, 4, {"SwitchCase": 1}], | ||
"one-var": [2, "never"], | ||
"no-trailing-spaces": [2, { "skipBlankLines": false }], | ||
"keyword-spacing": [2, { | ||
"before": true, | ||
"after": true | ||
}], | ||
"no-delete-var": 2, | ||
"no-empty": ["error", { "allowEmptyCatch": true }], | ||
"no-label-var": 2, | ||
"no-shadow": 2, | ||
"no-unused-vars": [ 1, { "args": "none" }], | ||
"no-console": 0 | ||
} | ||
} |
# 1.0.9 - 2017-01-27 | ||
- config cache fix (see haraka/Haraka#1738) | ||
- config: add overrides handling (sync with Haraka) | ||
- configfile: add win64 watching (sync with Haraka) | ||
- remove grunt | ||
- use haraka-eslint plugin (vs local copy of .eslintrc) | ||
- lint updates | ||
# 1.0.8 - 2017-01-02 | ||
* version bump, lint updates & sync | ||
* lint fixes | ||
# 1.0.7 - 2016-11-17 | ||
@@ -14,5 +28,5 @@ | ||
# 1.0.3 | ||
# 1.0.3 | ||
* added wildcard boolean support | ||
* reduce node required 4.3 -> 0.10.43 |
@@ -9,7 +9,6 @@ 'use strict'; | ||
function Config (root_path) { | ||
function Config (root_path, no_overrides) { | ||
this.root_path = root_path || cfreader.config_path; | ||
// console.log('root_path: ' + this.root_path); | ||
this.module_config = function (defaults_path, overrides_path) { | ||
var cfg = new Config(path.join(defaults_path, 'config')); | ||
var cfg = new Config(path.join(defaults_path, 'config'), true); | ||
if (overrides_path) { | ||
@@ -20,2 +19,6 @@ cfg.overrides_path = path.join(overrides_path, 'config'); | ||
}; | ||
if (process.env.HARAKA && !no_overrides) { | ||
this.overrides_path = root_path || cfreader.config_path; | ||
this.root_path = path.join(process.env.HARAKA, 'config'); | ||
} | ||
} | ||
@@ -52,3 +55,3 @@ | ||
else if (Array.isArray(overrides) && Array.isArray(defaults) && | ||
overrides.length > 0) { | ||
overrides.length > 0) { | ||
return overrides; | ||
@@ -55,0 +58,0 @@ } |
@@ -23,2 +23,11 @@ 'use strict'; | ||
cfreader.watch_files = true; | ||
cfreader._config_cache = {}; | ||
cfreader._read_args = {}; | ||
cfreader._watchers = {}; | ||
cfreader._enoent_timer = false; | ||
cfreader._enoent_files = {}; | ||
cfreader._sedation_timers = {}; | ||
cfreader._overrides = {}; | ||
var config_dir_candidates = [ | ||
@@ -48,7 +57,8 @@ path.join(__dirname, 'config'), // Haraka ./config dir | ||
for (var i=0; i < config_dir_candidates.length; i++) { | ||
for (let i=0; i < config_dir_candidates.length; i++) { | ||
let candidate = config_dir_candidates[i]; | ||
try { | ||
var stat = fs.statSync(config_dir_candidates[i]); | ||
var stat = fs.statSync(candidate); | ||
if (stat && stat.isDirectory()) { | ||
cfreader.config_path = config_dir_candidates[i]; | ||
cfreader.config_path = candidate; | ||
return; | ||
@@ -65,11 +75,2 @@ } | ||
cfreader.watch_files = true; | ||
cfreader._config_cache = {}; | ||
cfreader._read_args = {}; | ||
cfreader._watchers = {}; | ||
cfreader._enoent_timer = false; | ||
cfreader._enoent_files = {}; | ||
cfreader._sedation_timers = {}; | ||
cfreader._overrides = {}; | ||
cfreader.on_watch_event = function (name, type, options, cb) { | ||
@@ -185,3 +186,3 @@ return function (fse, filename) { | ||
cfreader.read_config = function(name, type, cb, options) { | ||
cfreader.read_config = function (name, type, cb, options) { | ||
// Store arguments used so we can re-use them by filename later | ||
@@ -201,6 +202,5 @@ // and so we know which files we've attempted to read so that | ||
// console.log('\tcache_key: ' + cache_key); | ||
if (cfreader._config_cache[cache_key]) { | ||
var cached = cfreader._config_cache[cache_key]; | ||
if (cfreader._config_cache[cache_key] !== undefined) { | ||
// console.log('\t' + name + ' is cached'); | ||
return cached; | ||
return cfreader._config_cache[cache_key]; | ||
} | ||
@@ -215,10 +215,13 @@ } | ||
// allows us to notice when files are newly created. | ||
var os = process.platform; | ||
if (os === 'linux' || os === 'win32') { | ||
cfreader.watch_dir(); | ||
return result; | ||
switch (process.platform) { | ||
case 'win32': | ||
case 'win64': | ||
case 'linux': | ||
cfreader.watch_dir(); | ||
break; | ||
default: | ||
// All other operating systems | ||
cfreader.watch_file(name, type, cb, options); | ||
} | ||
// All other operating systems | ||
cfreader.watch_file(name, type, cb, options); | ||
return result; | ||
@@ -225,0 +228,0 @@ }; |
@@ -6,3 +6,3 @@ { | ||
"description": "Haraka's config file loader", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"homepage": "http://haraka.github.io", | ||
@@ -23,4 +23,3 @@ "repository": { | ||
"eslint": "*", | ||
"grunt": "*", | ||
"grunt-eslint": "*", | ||
"eslint-plugin-haraka": "*", | ||
"nodeunit": "*" | ||
@@ -34,5 +33,6 @@ }, | ||
"test": "./run_tests", | ||
"lint": "./node_modules/.bin/grunt lint", | ||
"lint": "./node_modules/.bin/eslint *.js test/**/*.js", | ||
"lintfix": "./node_modules/.bin/eslint --fix *.js test/**/*.js", | ||
"cover": "./node_modules/.bin/istanbul cov run_tests" | ||
} | ||
} |
@@ -5,2 +5,3 @@ [![Build Status][ci-img]][ci-url] | ||
[![Windows Build status][apv-img]][apv-url] | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/haraka/haraka-config.svg)](https://greenkeeper.io/) | ||
@@ -7,0 +8,0 @@ # haraka-config |
@@ -17,3 +17,3 @@ 'use strict'; | ||
}, | ||
'has a load function': function(test) { | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
@@ -23,3 +23,3 @@ test.ok(typeof this.bin.load === 'function'); | ||
}, | ||
'throws when file is non-existent': function(test) { | ||
'throws when file is non-existent': function (test) { | ||
test.expect(2); | ||
@@ -35,3 +35,3 @@ try { | ||
}, | ||
'loads the test binary file': function(test) { | ||
'loads the test binary file': function (test) { | ||
test.expect(3); | ||
@@ -38,0 +38,0 @@ var testBin = 'test/config/test.binary'; |
@@ -17,3 +17,3 @@ 'use strict'; | ||
}, | ||
'has a load function': function(test) { | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
@@ -23,3 +23,3 @@ test.ok(typeof this.flat.load === 'function'); | ||
}, | ||
'throws when file is non-existent': function(test) { | ||
'throws when file is non-existent': function (test) { | ||
test.expect(2); | ||
@@ -35,3 +35,3 @@ try { | ||
}, | ||
'loads the test flat file, as list': function(test) { | ||
'loads the test flat file, as list': function (test) { | ||
test.expect(1); | ||
@@ -43,3 +43,3 @@ var result = this.flat.load( | ||
}, | ||
'loads the test flat file, unspecified type': function(test) { | ||
'loads the test flat file, unspecified type': function (test) { | ||
test.expect(1); | ||
@@ -51,3 +51,3 @@ var result = this.flat.load( | ||
}, | ||
'returns hostname for empty "me"': function(test) { | ||
'returns hostname for empty "me"': function (test) { | ||
test.expect(1); | ||
@@ -54,0 +54,0 @@ var result = this.flat.load( 'test/config/me', null, null, regex); |
@@ -20,3 +20,3 @@ 'use strict'; | ||
}, | ||
'has a load function': function(test) { | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
@@ -26,3 +26,3 @@ test.ok(typeof this.ini.load === 'function'); | ||
}, | ||
'loads the test ini file': function(test) { | ||
'loads the test ini file': function (test) { | ||
test.expect(1); | ||
@@ -29,0 +29,0 @@ var result = this.ini.load('test/config/test.ini', {}, regex); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
}, | ||
'has a load function': function(test) { | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
@@ -21,3 +21,3 @@ test.ok(typeof this.json.load === 'function'); | ||
}, | ||
'throws when file is non-existent': function(test) { | ||
'throws when file is non-existent': function (test) { | ||
test.expect(2); | ||
@@ -33,3 +33,3 @@ try { | ||
}, | ||
'loads the test JSON file': function(test) { | ||
'loads the test JSON file': function (test) { | ||
test.expect(3); | ||
@@ -36,0 +36,0 @@ var result = this.json.load('test/config/test.json'); |
@@ -15,3 +15,3 @@ 'use strict'; | ||
}, | ||
'has a load function': function(test) { | ||
'has a load function': function (test) { | ||
test.expect(1); | ||
@@ -21,3 +21,3 @@ test.ok(typeof this.yaml.load === 'function'); | ||
}, | ||
'throws when file is non-existent': function(test) { | ||
'throws when file is non-existent': function (test) { | ||
test.expect(2); | ||
@@ -33,3 +33,3 @@ try { | ||
}, | ||
'loads the test yaml file': function(test) { | ||
'loads the test yaml file': function (test) { | ||
test.expect(4); | ||
@@ -36,0 +36,0 @@ var result = this.yaml.load('test/config/test.yaml'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
296
70572
41
1620
21
2