haraka-config
Advanced tools
Comparing version 1.0.4 to 1.0.5
# 1.0.5 - 2016-10-25 | ||
* do not leave behind a `*` section in config (due to wildcard boolean) | ||
# 1.0.3 | ||
* added wildcard boolean support | ||
* reduce node required 4.3 -> 0.10.43 |
@@ -6,3 +6,3 @@ { | ||
"description": "Haraka's config file loader", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"homepage": "http://haraka.github.io", | ||
@@ -71,4 +71,4 @@ "repository": { | ||
"lint": "./node_modules/.bin/grunt lint", | ||
"coverage": "./node_modules/.bin/istanbul cov run_tests" | ||
"cover": "./node_modules/.bin/istanbul cov run_tests" | ||
} | ||
} |
@@ -111,2 +111,4 @@ 'use strict'; | ||
if (section === '*') continue; // wildcard, don't initialize | ||
// so boolean detection in the next section will match | ||
@@ -113,0 +115,0 @@ if (options.booleans.indexOf(section + '.' + key) === -1) { |
@@ -68,4 +68,8 @@ 'use strict'; | ||
var r = this.ini.load('test/config/test.ini', { | ||
booleans: ['+sect1.bool_true','-sect1.bool_false', | ||
'+sect1.bool_true_default', 'sect1.-bool_false_default'] | ||
booleans: [ | ||
'+sect1.bool_true', | ||
'-sect1.bool_false', | ||
'+sect1.bool_true_default', | ||
'sect1.-bool_false_default' | ||
] | ||
}, regex); | ||
@@ -81,6 +85,9 @@ test.strictEqual(r.sect1.bool_true, true); | ||
'test.ini, wildcard boolean' : function (test) { | ||
test.expect(2); | ||
test.expect(5); | ||
var r = this.ini.load('test/config/test.ini', { | ||
booleans: [ '*.is_bool' ] | ||
booleans: [ '+main.bool_true', '*.is_bool' ] | ||
}, regex); | ||
test.strictEqual(r['*'], undefined); | ||
test.strictEqual(r.main.bool_true, true); | ||
test.strictEqual(r.main.is_bool, undefined); | ||
test.strictEqual(r['foo.com'].is_bool, true); | ||
@@ -87,0 +94,0 @@ test.strictEqual(r['bar.com'].is_bool, false); |
Sorry, the diff of this file is not supported yet
66797
1544