Fix: Remove trailing slash from URLs in config.

Fixes: https://github.com/freifunkhamburg/ffffng/issues/33
This commit is contained in:
baldo 2017-05-06 16:58:42 +02:00
parent 7604ba0848
commit 94a51921fd

View file

@ -126,8 +126,18 @@ if (fs.existsSync(configJSONFile)) {
process.exit(1); process.exit(1);
} }
function stripTrailingSlash(obj, field) {
var url = obj[field];
if (_.isString(url) && _.last(url) === '/') {
obj[field] = url.substr(0, url.length - 1);
}
}
var config = deepExtend({}, defaultConfig, configJSON); var config = deepExtend({}, defaultConfig, configJSON);
stripTrailingSlash(config.server, 'baseUrl');
stripTrailingSlash(config.client.map, 'mapUrl');
module.exports = config; module.exports = config;
angular.module('ffffng').constant('config', config); angular.module('ffffng').constant('config', config);