How to use the nconf.reset function in nconf

To help you get started, we’ve selected a few nconf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-sdk-node / test / unit / client.js View on Github external
test('\n\n ** Config **\n\n', (t) => {
	// setup the environment
	process.argv.push('--test-4=argv');
	process.argv.push('--test-5=argv');
	process.env.TEST_3 = 'env';
	process.env.test_6 = 'mapped';
	// internal call. clearing the cached config.
	if (global && global.hfc) global.hfc.config = undefined;
	require('nconf').reset();

	t.equals(Client.getConfigSetting('request-timeout', 'notfound'), 45000, 'checking that able to get "request-timeout" value from an additional configuration file');
	//try adding another config file
	Client.addConfigFile(path.join(__dirname, '../fixtures/local.json'));
	t.equals(Client.getConfigSetting('test-2', 'notfound'), 'local', 'checking that able to test-2 value from an additional configuration file');
	t.equals(Client.getConfigSetting('test-3', 'notfound'), 'env', 'checking that test-3 environment values are used');
	t.equals(Client.getConfigSetting('test-4', 'notfound'), 'argv', 'checking that test-4 argument values are used');
	Client.setConfigSetting('test-5', 'program');
	t.equals(Client.getConfigSetting('test-5', 'notfound'), 'program', 'checking that test-5 program values are used');
	t.equals(Client.getConfigSetting('test-6', 'notfound'), 'mapped', 'checking that test-6 is enviroment mapped value');
	t.end();
});
github ElevenGiants / eleven-server / src / config.js View on Github external
function reset() {
	gsids = [];
	gameServers = {};
	gsid = null;
	//TODO: the following doesn't actually reset anything
	// (see )
	nconf.reset();
}
github hyperledger / fabric-sdk-node / test / integration / new-channel.js View on Github external
* Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an 'AS IS' BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
'use strict';

if (global && global.hfc) global.hfc.config = undefined;
require('nconf').reset();
var utils = require('fabric-client/lib/utils.js');
utils.setConfigSetting('hfc-logging', '{"debug":"console"}');
var logger = utils.getLogger('new-channel');

var tape = require('tape');
var _test = require('tape-promise');
var test = _test(tape);

var hfc = require('fabric-client');
var util = require('util');
var fs = require('fs');
var path = require('path');
var testUtil = require('../unit/util.js');
var Orderer = require('fabric-client/lib/Orderer.js');
var Peer = require('fabric-client/lib/Peer.js');
github hyperledger / fabric-sdk-node / test / unit / pkcs11.js View on Github external
return function () {
			if (global && global.hfc) {
				global.hfc.config = undefined;
			}
			require('nconf').reset();

			f.apply(context, arguments);
		};
	})(t, t.end);
github hyperledger / fabric-sdk-node / test / integration / util.js View on Github external
module.exports.resetDefaults = function() {
	global.hfc.config = undefined;
	require('nconf').reset();
};
github hyperledger / fabric-test / tools / PTE / pte-util.js View on Github external
module.exports.resetDefaults = function () {
    global.hfc.config = undefined;
    require('nconf').reset();
};
github hyperledger-archives / caliper / src / fabric / create-channel.js View on Github external
* you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an 'AS IS' BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

'use strict';

if (global && global.hfc) global.hfc.config = undefined;
require('nconf').reset();
var utils = require('fabric-client/lib/utils.js');
var logger = utils.getLogger('E2E create-channel');

var tape = require('tape');
var _test = require('tape-promise');
var test = _test(tape);

var Client = require('fabric-client');
var util = require('util');
var fs = require('fs');
var path = require('path');
var grpc = require('grpc');

var testUtil = require('./util.js');
var e2eUtils = require('./e2eUtils.js');
github hyperledger / caliper / packages / caliper-fabric / lib / util.js View on Github external
module.exports.resetDefaults = function() {
    global.hfc.config = undefined;
    require('nconf').reset();
};
github nexledger / accelerator / innovation-sandbox / caliper / src / adapters / accelerator / util.js View on Github external
module.exports.resetDefaults = function() {
    global.hfc.config = undefined;
    require('nconf').reset();
};
github dongmingh / v1performance / pte-util.js View on Github external
module.exports.resetDefaults = function() {
	global.hfc.config = undefined;
	require('nconf').reset();
};

nconf

Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.

MIT
Latest version published 6 months ago

Package Health Score

82 / 100
Full package analysis