Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import glob from 'glob';
import nconf from 'nconf';
import R from 'ramda';
import '../src/init-config';
import '../src/redis';
import startExpress from '../src/express';
import { init as initPhantom } from '../src/phantom';
// Defaults
startExpress();
initPhantom();
nconf.set('CLIENT_ID', '123');
const glob_options = {
realpath: true,
nodir: true
};
const test_files = R.flatten([
glob.sync('./tests/*/*.js', glob_options),
glob.sync('./tests/*(!(index.js))', glob_options)
]);
R.forEach(test_case => require(test_case), test_files);
exports.setupPOST = function (request, response) {
var showError = function (message) {
// TODO: actually show the error message
response.render('setup');
};
if (request.body.account &&
request.body.accessKey &&
request.body.WaRuntimeEndpoint) {
nconf.set('AZURE_STORAGE_ACCOUNT', request.body.account);
nconf.set('AZURE_STORAGE_ACCESS_KEY', request.body.accessKey);
nconf.set('WaRuntimeEndpoint', request.body.WaRuntimeEndpoint);
nconf.save(function (error) {
if (error) {
showError(error);
} else {
response.redirect('/');
}
});
} else {
showError();
}
};
nconf.file({ file: path.join(__dirname, '../../config.json') });
nconf.defaults({
base_dir: path.join(__dirname, '../..'),
themes_path: path.join(__dirname, '../../node_modules'),
upload_path: 'test/uploads',
views_dir: path.join(__dirname, '../../build/public/templates'),
relative_path: '',
});
const urlObject = url.parse(nconf.get('url'));
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('relative_path', relativePath);
if (!nconf.get('isCluster')) {
nconf.set('isPrimary', 'true');
nconf.set('isCluster', 'true');
}
const dbType = nconf.get('database');
const testDbConfig = nconf.get('test_database');
const productionDbConfig = nconf.get(dbType);
if (!testDbConfig) {
const errorText = 'test_database is not defined';
winston.info(
'\n===========================================================\n' +
'Please, add parameters for test database in config.json\n' +
'For example (redis):\n' +
'"test_database": {\n' +
' "host": "127.0.0.1",\n' +
' "port": "6379",\n' +
createRequest(dlQueues[packObj.server][packObj.nick][0]);
}
}else{
self.emit("dequeuePending#"+packObj.server+"#"+packObj.nick+"#"+packObj.nr);
}
} else {
dlQueues[packObj.server][packObj.nick].splice(index, 1);
}
if (dlQueues[packObj.server][packObj.nick].length == 0)
delete dlQueues[packObj.server][packObj.nick];
if (Object.keys(dlQueues[packObj.server]).length == 0)
delete dlQueues[packObj.server];
nconf.set('downloads', dlQueues);
nconf.save();
}
}
import nconf from 'nconf';
import fse from 'fs-extra';
import process from './process';
import path from 'path';
nconf.use('memory')
.argv({
/*
inspect: {default: undefined},
*/
})
.env(['NODE_ENV']);
nconf.set('NODE_ENV', nconf.get('NODE_ENV') || 'development')
nconf.set('port', nconf.get('port') || 8080);
nconf.set('domain', nconf.get('domain') || 'localhost');
nconf.set('output', nconf.get('path') || path.resolve(__dirname, '..','build/public/'))
nconf.set('jspath', nconf.get('jspath') || 'js')
nconf.set('htmlpath', nconf.get('htmlpath') || 'html')
nconf.set('imagepath', nconf.get('imagepath') || 'images')
nconf.set('protocol', nconf.get('protocol') || 'http');
nconf.set('publicPath', nconf.get('publicPath') || '/');
fse.outputJson(
'config.json',
nconf.get(),
function cb(err, data) {
if (err) console.error('config/index',err);
console.log('return process')
return process(nconf);
}
)
import fse from 'fs-extra';
import process from './process';
import path from 'path';
nconf.use('memory')
.argv({
/*
inspect: {default: undefined},
*/
})
.env(['NODE_ENV']);
nconf.set('NODE_ENV', nconf.get('NODE_ENV') || 'development')
nconf.set('port', nconf.get('port') || 8080);
nconf.set('domain', nconf.get('domain') || 'localhost');
nconf.set('output', nconf.get('path') || path.resolve(__dirname, '..','build/public/'))
nconf.set('jspath', nconf.get('jspath') || 'js')
nconf.set('htmlpath', nconf.get('htmlpath') || 'html')
nconf.set('imagepath', nconf.get('imagepath') || 'images')
nconf.set('protocol', nconf.get('protocol') || 'http');
nconf.set('publicPath', nconf.get('publicPath') || '/');
fse.outputJson(
'config.json',
nconf.get(),
function cb(err, data) {
if (err) console.error('config/index',err);
console.log('return process')
return process(nconf);
}
)
const {
getHoganFor
} = require('hogan-cache')
const htmlPdf = require('html-pdf')
const file = path.resolve(__dirname, 'config.json')
nconf
.env()
.argv()
.file({ file })
let script = nconf.get('htmlPdf:script')
script = path.resolve(__dirname, script)
nconf.set('htmlPdf:script', script)
const executeMakeFace = (parameters) => (
('makeFace' in parameters)
? makeFace(parameters.makeFace.srcPath, parameters.makeFace.cssPath)
.then(() => parameters)
: parameters
)
const executeReadFace = (parameters) => (
('readFace' in parameters)
? readFace(parameters.readFace.path)
.then((readFace) => ({ ...parameters, readFace }))
: parameters
)
const executeHoganFor = (parameters) => (
Config.prototype.initialize = function initialize() {
this.localfs.createDirIfNotExists(confDir, true);
const configExists = this.localfs.checkExists(confFile, 'conf file', false);
if (configExists) {
logger.showResult('conf file already exists.');
} else {
nconf.set('config', {});
this.saveConfig(false);
logger.showResult('conf file created.');
}
logger.showResult('wizzy successfully initialized.');
};
function (cb) {
nconf.set('PROVISIONING_TICKET', provisioningTicket);
nconf.set('WSFED_ISSUER', info.connectionDomain);
nconf.set('SITE_NAME', nconf.get('SITE_NAME') || info.connectionDomain);
nconf.set(info.realm.name, info.realm.postTokenUrl);
extraEmptyVars.forEach(function (ev) {
if (!nconf.get(ev)) nconf.set(ev, '');
});
nconf.save(cb);
},
function (cb) {