From 4b98b7056ad8788040c3ffcecf89d217d0280716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 5 Apr 2017 18:47:44 +0200 Subject: [PATCH] Make zip command path configurable --- app/models/formats/ogr/shp.js | 7 +++---- config/environments/development.js.example | 2 ++ config/environments/production.js.example | 2 ++ config/environments/staging.js.example | 2 ++ config/environments/test.js.example | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/models/formats/ogr/shp.js b/app/models/formats/ogr/shp.js index 4dd59f35..8a2a64db 100644 --- a/app/models/formats/ogr/shp.js +++ b/app/models/formats/ogr/shp.js @@ -33,10 +33,10 @@ ShpFormat.prototype.toSHP = function (options, callback) { var filename = options.filename; var fmtObj = this; - var zip = 'zip'; // FIXME: make configurable + var zip = global.settings.zipCommand || 'zip'; var tmpdir = global.settings.tmpDir || '/tmp'; var reqKey = [ 'shp', dbname, user_id, gcol, this.generateMD5(sql) ].concat(skipfields).join(':'); - var outdirpath = tmpdir + '/sqlapi-' + process.pid + '-' + reqKey; + var outdirpath = tmpdir + '/sqlapi-' + process.pid + '-' + reqKey; var zipfile = outdirpath + '.zip'; var shapefile = outdirpath + '/' + filename + '.shp'; @@ -63,7 +63,7 @@ ShpFormat.prototype.toSHP = function (options, callback) { //console.log("Zip complete, zip return code was " + code); if (code) { next(new Error("Zip command return code " + code)); - //res.statusCode = 500; + //res.statusCode = 500; } next(null); }); @@ -116,4 +116,3 @@ ShpFormat.prototype.toSHP = function (options, callback) { module.exports = ShpFormat; - diff --git a/config/environments/development.js.example b/config/environments/development.js.example index 0e2bce87..5aea37c0 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -84,6 +84,8 @@ module.exports.tableCacheMaxAge = 1000*60*10; module.exports.tmpDir = '/tmp'; // change ogr2ogr command or path module.exports.ogr2ogrCommand = 'ogr2ogr'; +// change zip command or path +module.exports.zipCommand = 'zip'; // Optional statsd support module.exports.statsd = { host: 'localhost', diff --git a/config/environments/production.js.example b/config/environments/production.js.example index 2411a6bb..216346dc 100644 --- a/config/environments/production.js.example +++ b/config/environments/production.js.example @@ -85,6 +85,8 @@ module.exports.tableCacheMaxAge = 1000*60*10; module.exports.tmpDir = '/tmp'; // change ogr2ogr command or path module.exports.ogr2ogrCommand = 'ogr2ogr'; +// change zip command or path +module.exports.zipCommand = 'zip'; // Optional statsd support module.exports.statsd = { host: 'localhost', diff --git a/config/environments/staging.js.example b/config/environments/staging.js.example index 4fa2f10d..736e492d 100644 --- a/config/environments/staging.js.example +++ b/config/environments/staging.js.example @@ -85,6 +85,8 @@ module.exports.tableCacheMaxAge = 1000*60*10; module.exports.tmpDir = '/tmp'; // change ogr2ogr command or path module.exports.ogr2ogrCommand = 'ogr2ogr'; +// change zip command or path +module.exports.zipCommand = 'zip'; // Optional statsd support module.exports.statsd = { host: 'localhost', diff --git a/config/environments/test.js.example b/config/environments/test.js.example index 203e5e39..3911ccf2 100644 --- a/config/environments/test.js.example +++ b/config/environments/test.js.example @@ -82,6 +82,8 @@ module.exports.tableCacheMaxAge = 1000*60*10; module.exports.tmpDir = '/tmp'; // change ogr2ogr command or path module.exports.ogr2ogrCommand = 'ogr2ogr'; +// change zip command or path +module.exports.zipCommand = 'zip'; // Optional statsd support module.exports.statsd = { host: 'localhost',