Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
// Create the configuration for the test.
const conf = new nconf.Provider()
// Force the settings for the test.
const testOpts = {
base: path.join('test', 'fixtures', name)
}
extend(testOpts, opts)
conf.overrides(testOpts)
// Create the environment.
const kalastatic = new KalaStatic(conf)
kalastatic.build().then(() => {
// Make sure the build passes.
const base = kalastatic.nconf.get('base')
const build = path.join(base, kalastatic.nconf.get('destination'))
const expected = path.join(base, 'expected')
assertDir(build, expected)
process.on('SIGHUP', () => {
control.tor_pool.new_identites();
});
process.on('exit', cleanUp);
process.on('SIGINT', cleanUp);
process.on('SIGTERM', cleanUp);
process.on('uncaughtException', cleanUp.bind({ handleError: true }));
}
/**
* Instance of `nconf.Provider`
* @type {Provider}
*/
let nconf = new Provider();
let argv_config =
yargs
.version(package_json.version)
.usage('Usage: tor-router [arguments]')
.options({
f: {
alias: 'config',
describe: 'Path to a config file to use',
demand: false
},
c: {
alias: 'controlHost',
describe: `Host the control server will bind to, handling TCP connections [default: ${default_ports.default_host}:9077]`,
demand: false
// ,default: 9077
Configuration.prototype.init = function (next) {
if (typeof next !== 'function') {
next = function (err) {
if (err) {
console.error(err.message)
}
};
}
var Provider = require('nconf').Provider;
this.nconf = new Provider();
this.load(next);
}
exports.createClient = function (options) {
var nconf = require('nconf'),
store = new nconf.Provider();
nconf.use('memory');
if (true !== options.disableGlobalState) {
nconf.env().argv({
's': {
alias: 'subdomain'
},
'u': {
alias: 'username'
},
'p': {
alias: 'password'
},
't': {
alias: 'token'
},
'r': {
function ConfigAPI() {
let cfg = new nconf.Provider();
cfg.argv().env({ separator: '__' });
this._configProvider = cfg;
}
_private.loadNconf = function loadNconf() {
let baseConfigPath = __dirname,
customConfigPath = process.cwd(),
nconf = new Nconf.Provider();
/**
* command line arguments
*/
nconf.argv();
/**
* env arguments
*/
nconf.env({
separator: '__'
});
nconf.file('custom-env', path.join(customConfigPath, 'config.' + env + '.json'));
nconf.file('default-env', path.join(baseConfigPath, 'env', 'config.' + env + '.json'));
"use strict";
/**
* Persistent configuration wrapper
* @todo notificate somehow. maybe implementing as event emitter.
* @module SlingConfig
*/
/** Module dependencies. */
const nconf = new require("nconf");
const homeDir = (process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE),
appHome = homeDir + "/.slingxdcc/",
settings = new nconf.Provider(),
dl = new nconf.Provider(),
nw = new nconf.Provider();
nw.file({file: appHome + "networks.json"});
dl.file({file: appHome + "downloads.json"});
settings.file({file: appHome + "settings.json"});
settings.defaults({
db: {
compactThreshold: 50000,
pageSize: 30,
cacheTTL: 600000,
maxResults: 3000,
defaultSorting: {date: -1}
},
basic: {
var setupConfig = function setupConfig() {
var env = require('./env');
var defaults = {};
var parentPath = utils.getCWDRoot();
config = new nconf.Provider();
if (parentPath && fs.existsSync(path.join(parentPath, 'config.example.json'))) {
defaults = require(path.join(parentPath, 'config.example.json'));
}
config.argv()
.env({
separator: '__'
})
.file({
file: path.join(parentPath, 'config.' + env + '.json')
});
config.set('env', env);
config.defaults(defaults);
SettingsService.prototype.initialize = function () {
"use strict";
var base, configFile;
this._memoryStore = new nconf.Provider();
this._memoryStore.use('memory');
this._fileStore = new nconf.Provider();
this._fileStore.env().argv();
base = path.resolve(path.dirname(require.main.filename), '..');
configFile = path.join(base, 'config', (this._fileStore.get('NODE_ENV') || 'development') + '.json');
try {
if (!fs.existsSync(configFile)) {
fs.outputFileSync(configFile, '{}');
}
} catch (e) {
logger.log('error', e.message, e.stack);
}
SettingsService.prototype.initialize = function () {
"use strict";
var base, configFile;
this._memoryStore = new nconf.Provider();
this._memoryStore.use('memory');
this._fileStore = new nconf.Provider();
this._fileStore.env().argv();
base = path.resolve(path.dirname(require.main.filename), '..');
configFile = path.join(base, 'config', (this._fileStore.get('NODE_ENV') || 'development') + '.json');
try {
if (!fs.existsSync(configFile)) {
fs.outputFileSync(configFile, '{}');
}
} catch (e) {
logger.log('error', e.message, e.stack);
}
this._fileStore.file(configFile);