Get templateHash for static tile request and errored named map instantiations

This commit is contained in:
Daniel García Aubert
2020-04-30 13:09:12 +02:00
parent 8d73571f5b
commit a196a26ab4
4 changed files with 32 additions and 12 deletions
@@ -4,7 +4,7 @@ const BaseMapConfigProvider = require('./base-mapconfig-adapter');
const crypto = require('crypto');
const dot = require('dot');
const MapConfig = require('windshaft').model.MapConfig;
const templateName = require('../../../backends/template-maps').templateName;
const { templateName, fingerPrint: templateFingerPrint } = require('../../../backends/template-maps');
// Configure bases for cache keys suitable for string interpolation
const baseKey = '{{=it.dbname}}:{{=it.user}}:{{=it.templateName}}';
@@ -258,6 +258,14 @@ module.exports = class NamedMapMapConfigProvider extends BaseMapConfigProvider {
getTemplateName () {
return this.templateName;
}
getTemplateHash () {
if (!this.template) {
throw new Error('Missing template, call "getTemplate()" method first');
}
return templateFingerPrint(this.template);
}
};
function createConfigHash (config) {