From 2e44de5bd24cab6667ca3b9086791e2628778a80 Mon Sep 17 00:00:00 2001 From: Joseph Canero Date: Tue, 3 Oct 2017 18:42:52 -0400 Subject: [PATCH] allow the optional to force adding the key parameter to the sprite url --- src/serve_style.js | 3 ++- src/server.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/serve_style.js b/src/serve_style.js index 491d584..2683669 100644 --- a/src/serve_style.js +++ b/src/serve_style.js @@ -121,7 +121,8 @@ module.exports = function (options, repo, params, id, reportTiles, reportFont) { }); // mapbox-gl-js viewer cannot handle sprite urls with query 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) { styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false, true); diff --git a/src/server.js b/src/server.js index a54e0b2..c2c9212 100644 --- a/src/server.js +++ b/src/server.js @@ -70,6 +70,7 @@ function start(opts) { options.auth = options.auth || {}; options.auth.keyName = options.auth.keyName || 'key'; options.auth.keyDomains = options.auth.keyDomains || []; + options.auth.forceSpriteKey = options.auth.forceSpriteKey || false; console.log("options:", options);