From bd7bedae9fed7fd1efb986253866ab9da7e0b71f Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Thu, 12 May 2016 15:16:52 +0100 Subject: [PATCH] updated nano to use secure couchdb --- htpasswd.txt | 1 + logger-server.js | 12 ++++++++++++ package.json | 1 + 3 files changed, 14 insertions(+) create mode 100644 htpasswd.txt diff --git a/htpasswd.txt b/htpasswd.txt new file mode 100644 index 0000000..98b5d51 --- /dev/null +++ b/htpasswd.txt @@ -0,0 +1 @@ +martind2000:ae7dfe3f3ba4d1132f8c7d7e5a2d05676127458a8842b9c28cea7662ad45393c diff --git a/logger-server.js b/logger-server.js index 2e2b247..516153a 100644 --- a/logger-server.js +++ b/logger-server.js @@ -8,8 +8,20 @@ var express = require('express'), path = require('path'), http = require('http') loggerHandler = require('./server/loggerhandler') ; + +var authentication =require('basic-authentication'); + + var app = express(); +app.use(authentication(({ + hash: 'sha256', // type of hash + file: 'htpasswd.txt', // path of file + suppress: true // suppress throwing Error if wrong user +}))); + + + app.set('port', process.env.PORT || 8027); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); diff --git a/package.json b/package.json index be6acd3..d129e4e 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "basic-authentication": "^1.6.2", "body-parser": "^1.15.0", "cheerio": "^0.20.0", "cookie-parser": "^1.4.1",