Make zip command path configurable

This commit is contained in:
Daniel García Aubert 2017-04-05 18:47:44 +02:00 committed by Mario de Frutos
parent 9a2e832c83
commit 4b98b7056a
5 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',