From 77d70a9d223b417239adddc144bf878b7097d51e Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Sun, 21 Apr 2013 14:15:26 +0200 Subject: [PATCH] configurable importer_path --- importer.js | 2 +- routes.js | 2 +- server.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/importer.js b/importer.js index b45ee09..cdb03fb 100644 --- a/importer.js +++ b/importer.js @@ -164,7 +164,7 @@ module.exports = function (config, mongoInstance, sharemodel) { promises.push( helpers.replace(doc, import_file_tag, function (result, callback) { var parts = import_file_regexp.exec(result); - var filename = path.resolve(config.public_path, parts[1]); + var filename = path.resolve(config.importer_path, parts[1]); var context = { collection: parts[2], name: parts[3], diff --git a/routes.js b/routes.js index 7a004f9..d9b3ab1 100644 --- a/routes.js +++ b/routes.js @@ -319,7 +319,7 @@ module.exports = function (app, config) { var importerInstance = importer(config, mongodataInstance, model); app.get('/importer/:filename', function importFile(req, res, next) { - var filename = path.resolve(config.public_path, req.params.filename); + var filename = path.resolve(config.importer_path, req.params.filename); config.debug && console.log('/importer/:filename', filename); fs.readFile(filename, 'utf-8', function (err, sub_doc) { if (err) { diff --git a/server.js b/server.js index bdb8a55..ae77af0 100644 --- a/server.js +++ b/server.js @@ -23,6 +23,7 @@ var config = { staticpath: '/lib/share', db: {type: 'none'} }, + importer_path: __dirname + '/public', public_path: __dirname + '/public', markdown_client: __dirname + '/node_modules/markdown/lib', ace_client: __dirname + '/node_modules/share/examples/lib/ace'