Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
});
function reset() {
gsids = [];
gameServers = {};
gsid = null;
//TODO: the following doesn't actually reset anything
// (see )
nconf.reset();
}
* 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');
return function () {
if (global && global.hfc) {
global.hfc.config = undefined;
}
require('nconf').reset();
f.apply(context, arguments);
};
})(t, t.end);
module.exports.resetDefaults = function() {
global.hfc.config = undefined;
require('nconf').reset();
};
module.exports.resetDefaults = function () {
global.hfc.config = undefined;
require('nconf').reset();
};
* 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');
module.exports.resetDefaults = function() {
global.hfc.config = undefined;
require('nconf').reset();
};
module.exports.resetDefaults = function() {
global.hfc.config = undefined;
require('nconf').reset();
};
module.exports.resetDefaults = function() {
global.hfc.config = undefined;
require('nconf').reset();
};