allow the optional to force adding the key parameter to the sprite url

This commit is contained in:
Joseph Canero 2017-10-03 18:42:52 -04:00
parent e84503c9ac
commit 2e44de5bd2
2 changed files with 3 additions and 1 deletions

View file

@ -121,7 +121,8 @@ module.exports = function (options, repo, params, id, reportTiles, reportFont) {
}); });
// mapbox-gl-js viewer cannot handle sprite urls with query // mapbox-gl-js viewer cannot handle sprite urls with query
if (styleJSON_.sprite) { if (styleJSON_.sprite) {
styleJSON_.sprite = fixUrl(styleJSON_.sprite, true, true); var forceKeyParameter = options.auth.forceSpriteKey === true;
styleJSON_.sprite = fixUrl(styleJSON_.sprite, !forceKeyParameter, true);
} }
if (styleJSON_.glyphs) { if (styleJSON_.glyphs) {
styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false, true); styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false, true);

View file

@ -70,6 +70,7 @@ function start(opts) {
options.auth = options.auth || {}; options.auth = options.auth || {};
options.auth.keyName = options.auth.keyName || 'key'; options.auth.keyName = options.auth.keyName || 'key';
options.auth.keyDomains = options.auth.keyDomains || []; options.auth.keyDomains = options.auth.keyDomains || [];
options.auth.forceSpriteKey = options.auth.forceSpriteKey || false;
console.log("options:", options); console.log("options:", options);