Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Accept password from env variable too (for nodester, primarily)

  • Loading branch information...
commit 0a3349980cff76095a1f90a9a87093524beebc81 1 parent 4af73fa
@wachunga authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 server.js
View
9 server.js
@@ -22,7 +22,8 @@ var argv = require('optimist')
})
.argv;
-var PORT = process.env.app_port || argv.port;
+var port = process.env.app_port || argv.port;
+var password = process.env.admin_pass || argv.password;
// run with --optimized to use 'public-built/' directory
// build 'public-built/' using 'node r.js -o app.build.js'
var www_public = argv.optimized ? '/public-built' : '/public';
@@ -45,7 +46,7 @@ var app = express.createServer(
app.set('views', __dirname + '/views');
app.register('.html', require('ejs')); // call our views html
app.use(app.router);
-app.listen(PORT);
+app.listen(port);
app.get('/', function (req, res) {
var unlistedCount = projectDao.findUnlisted().length;
@@ -90,7 +91,7 @@ app.get('/project/:slug', function (req, res) {
}
});
-var auth = express.basicAuth('admin', argv.password);
+var auth = express.basicAuth('admin', password);
app.delete('/project/:slug', auth, function (req, res) {
console.log('trying to delete ' + req.params.slug);
@@ -104,5 +105,5 @@ app.get('/admin', auth, function (req, res) {
tracker.init(app);
-console.log('Ω running on port ' + PORT);
+console.log('Ω running on port ' + port);
Please sign in to comment.
Something went wrong with that request. Please try again.