Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try{
if(fs.statSync(configFile).isFile()){
return JSON.parse(fs.readFileSync(configFile));
} else {
return false;
}
} catch(e){
return false;
}
}
var mlconfig = getConfig()
var db = marklogic.createDatabaseClient({
host: mlconfig.host,
port: '8000',
user: mlconfig.username,
password: mlconfig.password,
database: 'Modules',
authType: 'DIGEST'
});
var mlauth = {user:mlconfig.username, pass:mlconfig.password, sendImmediately:false};
var buffer = [];
var upload = function(path){
var collection = undefined;
if(path.indexOf('docs') > -1){
collection = path.split('/').slice(-1)[0].split('.')[0];
function MarkLogicQuery() {
this.conn = config.marklogic.connection;
this.db = marklogic.createDatabaseClient(this.conn);
}
constructor(params: MlClientParameters) {
this.params = params
this.params.authType = params.authType.toUpperCase()
this.docsDbNumber = '0'
if (params.pathToCa !== '') {
try {
this.ca = fs.readFileSync(this.params.pathToCa, 'utf8')
} catch (e) {
throw new Error('Error reading CA file: ' + e.message)
}
}
if (this.params.authType !== 'DIGEST' && this.params.authType !== 'BASIC') {
this.params.authType = 'DIGEST'
}
this.mldbClient = ml.createDatabaseClient({
host: this.params.host, port: this.params.port,
user: this.params.user, password: this.params.pwd,
authType: this.params.authType, ssl: this.params.ssl,
ca: this.ca
})
this.mldbClient.eval('xdmp.database("' + this.params.contentDb + '")')
.result(null, null).then((response) => {
this.docsDbNumber = response[0]['value']
})
}
var getClient = function (user, password) {
return mlclient.createDatabaseClient(_.merge(
options.middleTier.db.clientConnection,
{
user: user,
password: password
}
));
};