Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongo-express

Package Overview
Dependencies
Maintainers
2
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-express - npm Package Compare versions

Comparing version 0.24.0 to 0.25.0

80

app.js

@@ -0,24 +1,82 @@

#!/usr/bin/env node
'use strict';
var express = require('express');
var config = require('./config');
var fs = require('fs');
var https = require('https');
var middleware = require('./middleware');
var app = express();
var defaultPort = 80;
var server = app;
var config;
var sslOptions;
var app = express();
try {
config = require('./config');
} catch (e) {
config = require('./config.default');
var argv = require('minimist')(process.argv.slice(2), {
alias: {
u: 'username',
p: 'password',
_: ['database', 'd'],
a: 'admin'
},
'boolean': ['a'],
'default': {
port: '8081'
}
});
config.site.port = Number.parseInt(argv.port, 10);
if (argv.u && argv.p && (argv.a ? !argv._.length : argv._.length)) { //TODO: Improve validation
if (argv.a) {
config.mongodb.admin = true;
config.mongodb.adminUsername = argv.u;
config.mongodb.adminPassword = argv.p;
} else {
config.mongodb.admin = false;
config.mongodb.auth[0] = {
username: argv.u,
password: argv.p,
database: argv._[0]
};
if ([argv.u, argv.p, argv._].every(function (ele) { return typeof ele === 'object'; })) { //TODO: Improve validation
argv.u.forEach(function (ele, i) {
config.mongodb.auth[i] = {
username: argv.u[i],
password: argv.p[i],
database: argv._[i]
};
});
}
}
} else {
console.log('Usage: mongoe [options] [dbname]');
console.log('');
console.log('Options:');
console.log(' -a, --admin enable admin login');
console.log(' -u, --username=USERNAME username for authentication. can pass multiple values.');
console.log(' -p, --password=PASSWORD password for authentication. can pass multiple values.');
console.log(' -d, --database=DATABASE use DATABASE. not needed when using admin login. can pass multiple values.');
console.log(' --port=PORT listen on PORT.');
console.log('');
console.log('Create config.js to supress this message.');
process.exit(0);
}
}
app.use('/', middleware(config));
app.set('read_only', config.options.readOnly || false);
var defaultPort = 80;
var server = app;
if (config.site.sslEnabled){
defaultPort = 443;
var https = require('https');
var fs = require('fs');
var sslOptions = {
sslOptions = {
key: fs.readFileSync(config.site.sslKey),
cert: fs.readFileSync(config.site.sslCert)
};
server = https.createServer(sslOptions, app);
server = https.createServer(sslOptions, app);
}

@@ -28,4 +86,4 @@

console.log('Mongo Express server listening',
'on port ' + (config.site.port || defaultPort),
'at ' + (config.site.host || '0.0.0.0'));
'on port ' + (config.site.port || defaultPort),
'at ' + (config.site.host || '0.0.0.0'));
});

8

package.json

@@ -5,3 +5,6 @@ {

"description": "Web-based admin interface for MongoDB",
"version": "0.24.0",
"version": "0.25.0",
"bin" : {
"mongoe" : "./app.js"
},
"repository": {

@@ -20,2 +23,3 @@ "type": "git",

"express-session": "1.11.3",
"minimist": "~1.2.0",
"method-override": "2.3.5",

@@ -26,3 +30,3 @@ "mongodb": "2.0.43",

"swig": "1.4.2",
"underscore": "1.8.3"
"underscore": "~1.8.0"
},

@@ -29,0 +33,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc