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.25.0 to 0.26.0

71

app.js

@@ -9,2 +9,3 @@ #!/usr/bin/env node

var middleware = require('./middleware');
var program = require('commander');
var app = express();

@@ -21,52 +22,30 @@ var defaultPort = 80;

var argv = require('minimist')(process.argv.slice(2), {
alias: {
u: 'username',
p: 'password',
_: ['database', 'd'],
a: 'admin'
},
'boolean': ['a'],
'default': {
port: '8081'
}
});
program
.version(require('./package').version)
.option('-u, --username <username>', 'username for authentication')
.option('-p, --password <password>', 'password for authentication')
.option('-a, --admin', 'enable authentication as admin')
.option('-d, --database <database>', 'authenticate to database')
.option('--port <port>', 'listen on specified port')
.parse(process.argv);
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]
};
});
config.mongodb.admin = !!program.admin;
if (program.admin) {
config.mongodb.adminUsername = program.username;
config.mongodb.adminPassword = program.password;
} else {
var user = {
database: program.database,
username: program.username,
password: program.password
};
for (var key in user) {
if (!user[key]) {
program.help();
}
}
} 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);
config.mongodb.auth[0] = user;
}
config.site.port = program.port || config.site.port;
config.useBasicAuth = false;
}

@@ -73,0 +52,0 @@

@@ -9,6 +9,6 @@ 'use strict';

function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
// function f(n) {
// // Format integers to have at least two digits.
// return n < 10 ? '0' + n : n;
// }

@@ -38,7 +38,7 @@ /*

var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
// var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var gap;
var indent;
var meta = { // table of character substitutions
'\b': '\\b',

@@ -51,4 +51,4 @@ '\t': '\\t',

'\\': '\\\\'
},
rep;
};
var rep;

@@ -55,0 +55,0 @@

@@ -5,5 +5,5 @@ {

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

@@ -20,6 +20,6 @@ "repository": {

"cookie-parser": "1.4.0",
"commander": "^2.8.1",
"errorhandler": "1.4.2",
"express": "4.13.3",
"express-session": "1.11.3",
"minimist": "~1.2.0",
"method-override": "2.3.5",

@@ -26,0 +26,0 @@ "mongodb": "2.0.43",

@@ -28,3 +28,2 @@ mongo-express

* Support for replica set connections
* Web-based command-line interface
* Site authentication

@@ -69,2 +68,3 @@ * REST interface

**To configure:**

@@ -98,20 +98,21 @@

**To mount as Express 4 middleware (see `node_modules/mongo-express/app.js`):**
If you installed it globally, you can immediately start mongo-express like this:
var
express = require('express')
, http = require('http')
;
mongo-express -u user -p password -d database
var
config = require('./config')
, middleware = require('./middleware')
;
Or if you want to use it as an administrator:
var app = express();
app.use('/your-mountpath', middleware(config));
app.listen(config.site.port, function() {
console.log("Mongo Express server listening on port " + (config.site.port || 80));
});
mongo-express -u superuser -p password
For help on configuration options:
mongo-express -h
**To mount as Express 4 middleware (see `node_modules/mongo-express/app.js`):**
var mongo_express = require('mongo-express/middleware')
var mongo_express_config = require('./mongo_express_config')
app.use('/mongo_express', mongo_express(mongo_express_config))
**To run as a Docker container:**

@@ -118,0 +119,0 @@

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