diff --git a/lib/index-web.js b/lib/index-web.js index 547eaa3a2..5a598a3ac 100644 --- a/lib/index-web.js +++ b/lib/index-web.js @@ -37,11 +37,6 @@ module.exports = function(config, auth, storage) { }) }) - app.get('/favicon.ico', function(req, res, next) { - req.url = '/-/static/favicon.png' - next() - }) - // Static app.get('/-/static/:filename', function(req, res, next) { var file = __dirname + '/static/' + req.params.filename diff --git a/lib/index.js b/lib/index.js index 1d5873d4a..0e9a58b05 100644 --- a/lib/index.js +++ b/lib/index.js @@ -103,13 +103,10 @@ module.exports = function(config_hash) { app.param('org_couchdb_user', match(/^org\.couchdb\.user:/)) app.param('anything', match(/.*/)) - if (config.web && config.web.enable) { - app.use(require('./index-web')(config, auth, storage)) - } else { - app.get('/', function(req, res) { - res.send('Web interface is disabled in the config file') - }) - } + app.get('/favicon.ico', function(req, res, next) { + req.url = '/-/static/favicon.png' + next() + }) /* app.get('/-/all', function(req, res) { var https = require('https') @@ -415,7 +412,15 @@ module.exports = function(config_hash) { res.report_error(err) }) - app.get('/*', function(req, res, next) { + if (config.web && config.web.enable) { + app.use(require('./index-web')(config, auth, storage)) + } else { + app.get('/', function(req, res) { + res.send('Web interface is disabled in the config file') + }) + } + + app.use(function(req, res, next) { next( Error[404]('file not found') ) }) diff --git a/test/unit/config_def.js b/test/unit/config_def.js index 34b69e989..c3c0caae8 100644 --- a/test/unit/config_def.js +++ b/test/unit/config_def.js @@ -1,7 +1,7 @@ describe('config.yaml', function() { it('should be parseable', function() { - var source = require('fs').readFileSync(__dirname + '/../../lib/config_def.yaml', 'utf8') + var source = require('fs').readFileSync(__dirname + '/../../conf/default.yaml', 'utf8') require('js-yaml').safeLoad(source) }) })